@loaders.gl/loader-utils
Version:
Framework-independent loaders for 3D graphics formats
23 lines (19 loc) • 667 B
text/typescript
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
// Isolates Buffer references to ensure they are only bundled under Node.js (avoids big webpack polyfill)
// this file is selected by the package.json "browser" field).
/**
* Convert Buffer to ArrayBuffer
* Converts Node.js `Buffer` to `ArrayBuffer` (without triggering bundler to include Buffer polyfill on browser)
* @todo better data type
*/
export function toArrayBuffer(buffer) {
return buffer;
}
/**
* Convert (copy) ArrayBuffer to Buffer
*/
export function toBuffer(binaryData: ArrayBuffer | Buffer): Buffer {
throw new Error('Buffer not supported in browser');
}