aboutsummaryrefslogtreecommitdiffhomepage
path: root/js
diff options
context:
space:
mode:
authorGravatar Adam Cozzette <acozzette@gmail.com>2018-03-13 15:53:47 -0700
committerGravatar GitHub <noreply@github.com>2018-03-13 15:53:47 -0700
commit89b5333ad0f10058d5af62701c5ebea0db376c5b (patch)
tree5a2d5aca44a8b6c9a15b6ab8689ddede00346632 /js
parent4f110257c59136400975341828a8b3c04c2141ef (diff)
parentf8005a5d5ad41daebe7630fc39e3b8a19eb3bd87 (diff)
Merge pull request #4378 from acozzette/node-buffer
Revert "Removed mention of Buffer in byteSourceToUint8Array"
Diffstat (limited to 'js')
-rw-r--r--js/binary/utils.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/js/binary/utils.js b/js/binary/utils.js
index 87570ff8..55a9ccd4 100644
--- a/js/binary/utils.js
+++ b/js/binary/utils.js
@@ -971,6 +971,10 @@ jspb.utils.byteSourceToUint8Array = function(data) {
return /** @type {!Uint8Array} */(new Uint8Array(data));
}
+ if (data.constructor === Buffer) {
+ return /** @type {!Uint8Array} */(new Uint8Array(data));
+ }
+
if (data.constructor === Array) {
data = /** @type {!Array<number>} */(data);
return /** @type {!Uint8Array} */(new Uint8Array(data));