buffer-esm
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Buffer-ESM

A cross-platform, partial implementation shim of Node Buffer. Supports encoding and decoding strings.

Usage

Install via NPM and require in your project. There is also an ESM export, for use with browser or Deno.

const { BufferShim } = require('buffer-esm')
 
const buffer = BufferShim.from('These are the voyages...') // Assumes utf8 when no encoding is passed.
const firstByte = buffer[0] // 84
const base64 = buffer.toString('base64') // VGhlc2UgYXJlIHRoZSB2b3lhZ2VzLi4u
const utf8 = buffer.toString('utf8') // These are the voyages...

Package Sidebar

Install

npm i buffer-esm

Weekly Downloads

2,593

Version

1.2.0

License

MIT

Unpacked Size

62.3 kB

Total Files

10

Last publish

Collaborators

  • ahuggins_nhs