Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hcodes committed Sep 23, 2020
1 parent 3a3cf9c commit 2f75c82
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Quick check if a Node.js Buffer or Uint8Array is UTF-8.
`npm install isutf8`

## Usage

### commonjs
```js
'use strict';

Expand All @@ -26,5 +28,18 @@ console.log(isUtf8(arr)); // => true

```

### ES Modules or TypeScript
```js
import isUtf8 from 'isutf8';

const buf = Buffer.from([0xd0, 0x90]);
console.log(isUtf8(buf)); // => true

// or

const arr = new Uint8Array([0xd0, 0x90]);
console.log(isUtf8(arr)); // => true
```

## License
[MIT License](./LICENSE)

0 comments on commit 2f75c82

Please sign in to comment.