file-utils.js 323 B

1234567891011121314151617181920
  1. 'use strict'
  2. const fs = require('graceful-fs')
  3. const FileUtils = {
  4. readFile (path) {
  5. return fs.readFileSync(path).toString()
  6. },
  7. saveFile (path, content) {
  8. fs.writeFileSync(path, content)
  9. },
  10. copyFile (src, dest) {
  11. FileUtils.saveFile(dest, FileUtils.readFile(src))
  12. }
  13. }
  14. module.exports = FileUtils