aboutsummaryrefslogtreecommitdiffhomepage
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/binary/utils.js4
-rw-r--r--js/message.js2
2 files changed, 5 insertions, 1 deletions
diff --git a/js/binary/utils.js b/js/binary/utils.js
index bbf99cdf..3ecd08e9 100644
--- a/js/binary/utils.js
+++ b/js/binary/utils.js
@@ -970,6 +970,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));
diff --git a/js/message.js b/js/message.js
index 4e2517d3..220a5bdb 100644
--- a/js/message.js
+++ b/js/message.js
@@ -202,7 +202,7 @@ goog.define('jspb.Message.MINIMIZE_MEMORY_ALLOCATIONS', COMPILED);
/**
- * Does this browser support Uint8Aray typed arrays?
+ * Does this JavaScript environment support Uint8Aray typed arrays?
* @type {boolean}
* @private
*/