node.js 377 B

12345678910111213141516171819
  1. import { readFileSync, statSync, writeFile } from 'fs';
  2. import { format } from 'util';
  3. import { resolve } from 'path';
  4. export default {
  5. fs: {
  6. readFileSync,
  7. writeFile
  8. },
  9. format,
  10. resolve,
  11. exists: (file) => {
  12. try {
  13. return statSync(file).isFile();
  14. }
  15. catch (err) {
  16. return false;
  17. }
  18. }
  19. };