File: README.md

package info (click to toggle)
node-vinyl-fs 3.0.3-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,884 kB
  • sloc: makefile: 43; sh: 43
file content (16 lines) | stat: -rw-r--r-- 397 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#utf8 detector

Detect if a Buffer is utf8 encoded. 
It need The minimum amount of bytes is 4.


```javascript
    var fs = require('fs');
    var isUtf8 = require('is-utf8');
    var ansi = fs.readFileSync('ansi.txt');
    var utf8 = fs.readFileSync('utf8.txt');
    
    console.log('ansi.txt is utf8: '+isUtf8(ansi)); //false
    console.log('utf8.txt is utf8: '+isUtf8(utf8)); //true
```