diff options
Diffstat (limited to 'Functions/open.js')
-rw-r--r-- | Functions/open.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Functions/open.js b/Functions/open.js new file mode 100644 index 0000000..f04201b --- /dev/null +++ b/Functions/open.js @@ -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; |