buffer_decoder_helper.js 405 B

123456789101112131415161718
  1. /**
  2. * @fileoverview Helper methods to create BufferDecoders.
  3. */
  4. goog.module('protobuf.binary.bufferDecoderHelper');
  5. const BufferDecoder = goog.require('protobuf.binary.BufferDecoder');
  6. /**
  7. * @param {...number} bytes
  8. * @return {!BufferDecoder}
  9. */
  10. function createBufferDecoder(...bytes) {
  11. return BufferDecoder.fromArrayBuffer(new Uint8Array(bytes).buffer);
  12. }
  13. exports = {
  14. createBufferDecoder,
  15. };