Pārlūkot izejas kodu

Revert "Removed mention of Buffer in byteSourceToUint8Array"

This reverts commit 365e540d055636ae458f00a7d80959f9e9798e56.
David Ostrovsky 6 gadi atpakaļ
vecāks
revīzija
3cb0aeca93
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. 4 0
      js/binary/utils.js

+ 4 - 0
js/binary/utils.js

@@ -971,6 +971,10 @@ jspb.utils.byteSourceToUint8Array = function(data) {
     return /** @type {!Uint8Array} */(new Uint8Array(data));
     return /** @type {!Uint8Array} */(new Uint8Array(data));
   }
   }
 
 
+  if (data.constructor === Buffer) {
+    return /** @type {!Uint8Array} */(new Uint8Array(data));
+  }
+
   if (data.constructor === Array) {
   if (data.constructor === Array) {
     data = /** @type {!Array<number>} */(data);
     data = /** @type {!Array<number>} */(data);
     return /** @type {!Uint8Array} */(new Uint8Array(data));
     return /** @type {!Uint8Array} */(new Uint8Array(data));