npm.io
1.7.5 • Published 8 years ago

uchardet

Licence
MIT
Version
1.7.5
Deps
4
Size
1.2 MB
Vulns
0
Weekly
0
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

node-uchardet

Native uchardet Binding for Node

For more information on the native binding: https://www.freedesktop.org/wiki/Software/uchardet/

Install

via npm

npm install -S node-uchardet@icemanbeta/uchardet
via yarn
yarn add node-uchardet@icemanbeta/uchardet

Usage

Getting Started
CommonJS
const UChardet = require('uchardet');
const uchardet = new UChardet();
const charset = uchardet.detect('/path/to/file');
ES6
import * as UChardet from 'uchardet';
const uchardet = new UChardet();
const charset = uchardet.detect('/path/to/file');
API
detect(file)
  • file [string]: Relative or absolute path to the file (Note: Relative path is resolved to process.cwd(), resolve prior if this doesn't work for you)

Example:

const source = './test/resources/sample.ssa';
const charset = uchardet.detect(source);
console.log(charset);
// => TIS-620
version()

Example:

console.log(uchardet.version());
// => 0.0.6

Keywords