Merge pull request #16627 from Snuffleupagus/rm-Node-Buffer

[api-minor] Stop "supporting" binary data provided as `Buffer` in Node.js environments (PR 16055 follow-up)
This commit is contained in:
Tim van der Meij 2023-07-01 13:00:19 +02:00 committed by GitHub
commit e070e730c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -549,10 +549,9 @@ function getDataProp(val) {
typeof Buffer !== "undefined" && // eslint-disable-line no-undef
val instanceof Buffer // eslint-disable-line no-undef
) {
deprecated(
throw new Error(
"Please provide binary data as `Uint8Array`, rather than `Buffer`."
);
return new Uint8Array(val);
}
if (val instanceof Uint8Array && val.byteLength === val.buffer.byteLength) {
// Use the data as-is when it's already a Uint8Array that completely