diff options
author | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-02-09 22:24:26 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-02-09 22:24:26 +0200 |
commit | b270c4475ca6ed61784ed8368ab42fea3dc528e5 (patch) | |
tree | 2b895a8b5d7b0a8ed0c8eea37278e3ab10e048ba /Functions/open.js | |
parent | 41b36e79f32e6a9efffe1c0100ddc339dbaaeabb (diff) | |
download | LYLLRuoka-b270c4475ca6ed61784ed8368ab42fea3dc528e5.tar.gz LYLLRuoka-b270c4475ca6ed61784ed8368ab42fea3dc528e5.zip |
Merged all functions from the JoelHMikael/funcs
Necessary, because we don't want to complicate our update script & its anyways better like this. They weren't any complicated functions.
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; |