aboutsummaryrefslogtreecommitdiff
path: root/Functions/open.js
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/open.js')
-rw-r--r--Functions/open.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/Functions/open.js b/Functions/open.js
index f04201b..f532721 100644
--- a/Functions/open.js
+++ b/Functions/open.js
@@ -1,4 +1,5 @@
const fs = require("fs");
+const https = require("https");
function openFile(path)
{
@@ -13,4 +14,24 @@ function openFile(path)
});
}
-exports.file = openFile;
+async function urlOpen(path)
+{
+ return new Promise((resolve, reject) =>
+ {
+ let req = https.get(path, res =>
+ {
+ res.on("data", resolve);
+ });
+ });
+ req.on("error", e =>
+ {
+ console.error(e);
+ });
+ req.end();
+}
+
+
+module.exports = {
+ file: openFile,
+ url: urlOpen
+}; \ No newline at end of file