# encode-utf8 **Repository Path**: ArkTSCentralRepository/encode-utf8 ## Basic Information - **Project Name**: encode-utf8 - **Description**: encode-utf8 是一个将字符串转换为 UTF-8 编码的 ArrayBuffer 的工具。 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-21 - **Last Updated**: 2024-11-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # encode-utf8 基于[encode-utf8](https://www.npmjs.com/package/encode-utf8)原库2.0.0版本进行适配, 所有功能代码已经转换为`ArkTS`文件 ## Install ```sh ohpm install encode-utf8 ``` ## Description Turn a string into an ArrayBufferLike by using the UTF8 encoding. ## Usage ```typescript 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