Add support for Uint8(Clamped)Array input (#2511)

This commit is contained in:
Leon Radley
2021-01-06 10:49:24 +01:00
committed by GitHub
parent bf1b326988
commit 4821a11223
8 changed files with 141 additions and 33 deletions

View File

@@ -31,6 +31,9 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
} else if (is.buffer(input)) {
// Buffer
inputDescriptor.buffer = input;
} else if (is.uint8Array(input)) {
// Uint8Array or Uint8ClampedArray
inputDescriptor.buffer = Buffer.from(input.buffer);
} else if (is.plainObject(input) && !is.defined(inputOptions)) {
// Plain Object descriptor, e.g. create
inputOptions = input;