JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1428471
  • Score
    100M100P100Q202048F
  • License MIT

Package Exports

  • encode-utf8

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (encode-utf8) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Encode UTF8

Turn a string into an ArrayBuffer by using the UTF8 encoding.

Installation

npm install --save encode-uf8

Usage

const encodeUtf8 = require('encode-utf8')

console.log(encodeUtf8('Hello, World!'))
//=> ArrayBuffer { byteLength: 13 }

console.log(encodeUtf8('🐵 🙈 🙉 🙊'))
//=> ArrayBuffer { byteLength: 19 }

API

encodeUtf8(input: string): ArrayBuffer

Returns an ArrayBuffer with the string represented as UTF8 encoded data.