utf-8-validate (5.0.10)

Published 2026-02-24 14:08:07 +00:00 by atheaadmin

Installation

registry=
npm install utf-8-validate@5.0.10
"utf-8-validate": "5.0.10"

About this package

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

Dependencies

Dependencies

ID Version
node-gyp-build ^4.3.0

Development Dependencies

ID Version
mocha ^10.0.0
node-gyp ^9.1.0
prebuildify ^5.0.0

Keywords

utf-8-validate
Details
npm
2026-02-24 14:08:07 +00:00
0
Einar Otto Stangvik
MIT
155 KiB
Assets (1)
Versions (2) View all
6.0.5 2026-02-24
5.0.10 2026-02-24