zhanwencai 12d83acadd 更新支付回调 há 1 ano atrás
..
deps 12d83acadd 更新支付回调 há 1 ano atrás
prebuilds 12d83acadd 更新支付回调 há 1 ano atrás
src 12d83acadd 更新支付回调 há 1 ano atrás
LICENSE 12d83acadd 更新支付回调 há 1 ano atrás
README.md 12d83acadd 更新支付回调 há 1 ano atrás
binding.gyp 12d83acadd 更新支付回调 há 1 ano atrás
fallback.js 12d83acadd 更新支付回调 há 1 ano atrás
index.js 12d83acadd 更新支付回调 há 1 ano atrás
package.json 12d83acadd 更新支付回调 há 1 ano atrás

README.md

utf-8-validate

Version npm Linux/macOS/Windows Build

Check if a buffer contains valid UTF-8 encoded text.

Installation

npm install utf-8-validate --save-optional

The --save-optional flag tells npm to save the package in your package.json under the optionalDependencies key.

API

The module exports a single function which takes one argument.

isValidUTF8(buffer)

Checks whether a buffer contains valid UTF-8.

Arguments

  • buffer - The buffer to check.

Return value

true if the buffer contains only correct UTF-8, else false.

Example

'use strict';

const isValidUTF8 = require('utf-8-validate');

const buf = Buffer.from([0xf0, 0x90, 0x80, 0x80]);

console.log(isValidUTF8(buf));
// => true

License

MIT