1234567891011121314151617181920212223242526272829 |
- 'use strict'
- const fs = require('fs')
- module.exports = {
- readFile: filename => {
- return new Promise((resolve, reject) => {
- fs.readFile(filename, (err, data) => {
- if (err) {
- reject(err)
- } else {
- resolve(data)
- }
- })
- })
- },
- writeFile: (filename, data) => {
- return new Promise((resolve, reject) => {
- fs.writeFile(filename, data, err => {
- if (err) {
- reject(err)
- } else {
- resolve()
- }
- })
- })
- }
- }
|