aboutsummaryrefslogtreecommitdiff
path: root/Functions/open.js
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/open.js')
-rw-r--r--Functions/open.js16
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;