Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

buffer-to-uint8array

substack27.3kMIT1.1.0

convert a buffer (or string) to a Uint8Array

Uint8Array, u8, byte, buffer, typedarray

readme

buffer-to-uint8array

convert a buffer (or string) to a Uint8Array

example

var tou8 = require('buffer-to-uint8array');
var buf = new Buffer('whatever');
var a = tou8(buf);
console.log(a.constructor.name);
console.log(a);

methods

var tou8 = require('buffer-to-uint8array')

var u = tou8(buf)

Convert buf, a Buffer or string to a Uint8Array.

If buf is already a Uint8Array, it will be returned.

install

With npm do:

npm install buffer-to-uint8array

license

MIT