Merge pull request #200 from smartin015/master

Allow absolute paths to files in cli.js command line arguments
This commit is contained in:
Stewart Allen 2022-02-12 10:51:37 -05:00 committed by GitHub
commit 347ceb86e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,7 +68,10 @@ let exports_save = exports,
// fake fetch for worker to get wasm, if needed
let fetch = function(url, opts = {}) {
if (verbose) console.log({fetch: url});
let buf = fs.readFileSync(`${dir}/${url}`);
if (!url.startsWith('/')) {
url = `${dir}/${url}`;
}
let buf = fs.readFileSync(url);
return new Promise((resolve, reject) => {
resolve(new Promise((resolve, reject) => {
if (opts.format === 'string') {