diff options
Diffstat (limited to 'open.js')
-rw-r--r-- | open.js | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -0,0 +1,16 @@ +const fs = require("fs"); + +function openFile(path) +{ + return new Promise((resolve, reject) => + { + fs.readFile(path, (err, data) => + { + if (err) + reject(err); + resolve(data); + }) + }); +} + +exports.file = openFile; |