@loaders.gl/worker-utils
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -76,3 +76,3 @@ import { isBrowser, isWorker } from "../env-utils/globals.js"; | ||
async function loadAsArrayBuffer(url) { | ||
if (!node.readFileAsArrayBuffer || url.startsWith('http')) { | ||
if (isBrowser || !node.readFileAsArrayBuffer || url.startsWith('http')) { | ||
const response = await fetch(url); | ||
@@ -84,3 +84,3 @@ return await response.arrayBuffer(); | ||
async function loadAsText(url) { | ||
if (!node.readFileAsText || url.startsWith('http')) { | ||
if (isBrowser || !node.readFileAsText || url.startsWith('http')) { | ||
const response = await fetch(url); | ||
@@ -87,0 +87,0 @@ return await response.text(); |
@@ -29,3 +29,3 @@ import Module from 'module'; | ||
} | ||
const code = await fs.readFileSync(filename, 'utf8'); | ||
const code = await fs.promises.readFile(filename, 'utf8'); | ||
return requireFromString(code); | ||
@@ -32,0 +32,0 @@ } |
{ | ||
"name": "@loaders.gl/worker-utils", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Utilities for running tasks on worker threads", | ||
@@ -55,3 +55,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "9b4211dc0ecd4134a1638ac0a29c5ea9008fd971" | ||
"gitHead": "765e5a26a6bf3f2cc02cabffc4a1e3665ec92a53" | ||
} |
@@ -171,3 +171,3 @@ /* global importScripts */ | ||
async function loadAsArrayBuffer(url: string): Promise<ArrayBuffer> { | ||
if (!node.readFileAsArrayBuffer || url.startsWith('http')) { | ||
if (isBrowser || !node.readFileAsArrayBuffer || url.startsWith('http')) { | ||
const response = await fetch(url); | ||
@@ -185,3 +185,3 @@ return await response.arrayBuffer(); | ||
async function loadAsText(url: string): Promise<string> { | ||
if (!node.readFileAsText || url.startsWith('http')) { | ||
if (isBrowser || !node.readFileAsText || url.startsWith('http')) { | ||
const response = await fetch(url); | ||
@@ -188,0 +188,0 @@ return await response.text(); |
@@ -53,3 +53,3 @@ // Fork of https://github.com/floatdrop/require-from-string/blob/master/index.js | ||
} | ||
const code = await fs.readFileSync(filename, 'utf8'); | ||
const code = await fs.promises.readFile(filename, 'utf8'); | ||
return requireFromString(code); | ||
@@ -56,0 +56,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
326878