Skip to content

elixiao/file-encoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

file-encoding

detect encoding of a file

Install

npm install file-encoding --save
yarn add file-encoding

Usage

detect encoding of a file automatically:

const fileEncoding = require('file-encoding')
const fe = fileEncoding('./package.json')

fe.detect().then(encoding=>console.log(encoding)) // ascii

read file with detected encoding:

const fe = fileEncoding('./README.md')
fe.read().then(data=>console.log(data))

return decoded stream by iconv-lite:

const fe = fileEncoding('./README.md')
fe.stream().then(stream=>console.log(stream))

License

MIT

About

detect encoding of a file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published