aboutsummaryrefslogtreecommitdiff
path: root/js/binary/utils.js
diff options
context:
space:
mode:
authorstone4774 <25053818+stone4774@users.noreply.github.com>2018-03-22 11:16:34 +0800
committerGitHub <noreply@github.com>2018-03-22 11:16:34 +0800
commitc99f5278eb8dad6f42def88ce8b5a3453f6df4a8 (patch)
treec3cd284ec9d2981f61da266d040935b73275b5c4 /js/binary/utils.js
parentd053271deebe0efcd41729991b1f3d618b638ad5 (diff)
parented4321d1cb33199984118d801956822842771e7e (diff)
downloadprotobuf-c99f5278eb8dad6f42def88ce8b5a3453f6df4a8.tar.gz
protobuf-c99f5278eb8dad6f42def88ce8b5a3453f6df4a8.tar.bz2
protobuf-c99f5278eb8dad6f42def88ce8b5a3453f6df4a8.zip
Merge branch 'master' into fixbug_enum2json2
Diffstat (limited to 'js/binary/utils.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));