How to use the @protobufjs/utf8.read function in @protobufjs/utf8

To help you get started, we’ve selected a few @protobufjs/utf8 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brave / sync / lib / serializer.js View on Github external
Serializer.prototype.byteArrayToString = function (bytes/* : Uint8Array */) {
  return utf8.read(bytes, 0, bytes.length)
}
github dcos / dcos-ui / src / js / core / MesosStream.ts View on Github external
const getNextRecord = (buffer: Uint8Array): Uint8Array | null => {
  const newlineIndex = buffer.indexOf(10);
  if (newlineIndex === -1) {
    // this commonly happens if we have consumed all records and the
    // buffer is now empty.
    return null;
  }

  const start = newlineIndex + 1;
  const recordLength = parseInt(utf8.read(buffer, 0, newlineIndex), 10);
  return buffer.length >= recordLength + start
    ? buffer.slice(start, start + recordLength)
    : null;
};

@protobufjs/utf8

A minimal UTF8 implementation for number arrays.

BSD-3-Clause
Latest version published 7 years ago

Package Health Score

79 / 100
Full package analysis

Similar packages