run-npm-install (#44)
All checks were successful
Lint / pre-commit Linting (push) Successful in 1m30s
All checks were successful
Lint / pre-commit Linting (push) Successful in 1m30s
Reviewed-on: #44
This commit was merged in pull request #44.
This commit is contained in:
50
node_modules/utf-8-validate/README.md
generated
vendored
Normal file
50
node_modules/utf-8-validate/README.md
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# utf-8-validate
|
||||
|
||||
[](https://www.npmjs.com/package/utf-8-validate)
|
||||
[](https://github.com/websockets/utf-8-validate/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
|
||||
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`](https://docs.npmjs.com/files/package.json#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
|
||||
|
||||
```js
|
||||
'use strict';
|
||||
|
||||
const isValidUTF8 = require('utf-8-validate');
|
||||
|
||||
const buf = Buffer.from([0xf0, 0x90, 0x80, 0x80]);
|
||||
|
||||
console.log(isValidUTF8(buf));
|
||||
// => true
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
Reference in New Issue
Block a user