6.0.4 • Published 7 months ago

utf-8-validate v6.0.4

Weekly downloads
1,389,180
License
MIT
Repository
github
Last release
7 months ago

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

6.0.4

7 months ago

6.0.1

2 years ago

6.0.3

2 years ago

6.0.2

2 years ago

5.0.10

2 years ago

6.0.0

2 years ago

5.0.9

3 years ago

5.0.8

3 years ago

5.0.7

3 years ago

5.0.6

3 years ago

5.0.5

4 years ago

5.0.4

4 years ago

5.0.3

4 years ago

5.0.2

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

4.0.2

7 years ago

4.0.1

7 years ago

4.0.0-napi

7 years ago

4.0.0

7 years ago

3.0.4

7 years ago

3.0.3

7 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.0.0

8 years ago

1.2.2

8 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago