张佳燕 10c03ccc6b first | 8 months ago | |
---|---|---|
.. | ||
index.d.ts | 8 months ago | |
index.js | 8 months ago | |
package.json | 8 months ago | |
readme.md | 8 months ago | |
test.js | 8 months ago |
Turn a string into an ArrayBuffer by using the UTF8 encoding.
npm install --save encode-uf8
const encodeUtf8 = require('encode-utf8')
console.log(encodeUtf8('Hello, World!'))
//=> ArrayBuffer { byteLength: 13 }
console.log(encodeUtf8('🐵 🙈 🙉 🙊'))
//=> ArrayBuffer { byteLength: 19 }
encodeUtf8(input: string): ArrayBuffer
Returns an ArrayBuffer with the string represented as UTF8 encoded data.