node-require-url
v1.0.1
Published
A module to load other modules by URL
Downloads
4
Readme
node-require-url
A module to load other modules by URL
Install
npm install node-require-url
Usage
Async:
const node_require_url = require('node-require-url');
const hello = await node_require_url('https://gist.githubusercontent.com/westhecool/bec006616b8aa4deec3cd197ef3df0bf/raw/a43c25b95b4706d80b707c3ddda2de02a5c70bad/hello.js');
hello();
Callback:
const node_require_url = require('node-require-url');
const node_require_url_cb = (url, compatibilityMode, cb) => {
node_require_url(url, compatibilityMode).then((mod) => cb(null, mod)).catch((err) => cb(err, null))
}
node_require_url_cb('https://gist.githubusercontent.com/westhecool/bec006616b8aa4deec3cd197ef3df0bf/raw/a43c25b95b4706d80b707c3ddda2de02a5c70bad/hello.js', false, function(err, mod) {
mod();
});
compatibility mode
By default it runs in your os's temp dir set this to true to run it in the current directory.