encode-utf8

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

MIT 5 个版本
安装
npm install encode-utf8
yarn add encode-utf8
pnpm add encode-utf8
bun add encode-utf8
README

Encode UTF8

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

Installation

npm install --save encode-utf8

Usage

import encodeUtf8 from 'encode-utf8'

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

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

API

encodeUtf8(input)

  • input (string, required)
  • returns ArrayBuffer - an ArrayBuffer with the input string represented as UTF8 encoded data
版本列表
2.0.0 2021-07-24
1.0.3 2020-03-30
1.0.2 2018-04-30
1.0.1 2017-11-01
1.0.0 2017-10-31