You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 397B

12345678910111213141516
  1. #utf8 detector
  2. Detect if a Buffer is utf8 encoded.
  3. It need The minimum amount of bytes is 4.
  4. ```javascript
  5. var fs = require('fs');
  6. var isUtf8 = require('is-utf8');
  7. var ansi = fs.readFileSync('ansi.txt');
  8. var utf8 = fs.readFileSync('utf8.txt');
  9. console.log('ansi.txt is utf8: '+isUtf8(ansi)); //false
  10. console.log('utf8.txt is utf8: '+isUtf8(utf8)); //true
  11. ```