// package
typedarray-to-buffer
type: "module"
// preferences
// replacements (1)
snippet::typed-array-to-buffer
Simple or drop-in replacementThis package is no longer necessary. You can use `Buffer.from` to convert a Typed Array to `Buffer` and `ArrayBuffer.isView` to avoid a copy.
// example
ArrayBuffer.isView(arr)
? Buffer.from(
arr.buffer,
arr.byteOffset,
arr.byteLength,
)
: Buffer.from(arr);