Check if a file at the given path is UTF-8-encoded
const isFileUtf8 = require('is-file-utf8');
(async () => {
await isFileUtf8('package.json'); //=> true
await isFileUtf8('screenshot.png'); //=> false
})();
npm install is-file-utf8
const isFileUtf8 = require('is-file-utf8');
path: string
Buffer
URL
Return: Promise<boolean>
ISC License © 2018 Shinnosuke Watanabe