Add support for TypedArray input with byteOffset and length

This commit is contained in:
codepage949
2022-03-28 04:18:58 +09:00
committed by GitHub
parent 1d36936954
commit c3a0d5f5d0
2 changed files with 19 additions and 1 deletions

View File

@@ -39,7 +39,7 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
if (input.length === 0) {
throw Error('Input Bit Array is empty');
}
inputDescriptor.buffer = Buffer.from(input.buffer);
inputDescriptor.buffer = Buffer.from(input.buffer, input.byteOffset, input.byteLength);
} else if (is.plainObject(input) && !is.defined(inputOptions)) {
// Plain Object descriptor, e.g. create
inputOptions = input;