Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 16, 2024 via pnpm

chardet 0.7.0

Character detector
Package summary
Share
0
issues
1
license
1
MIT
Package created
30 Apr 2013
Version published
17 Aug 2018
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
chardet@0.7.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of chardet 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does chardet do?

Chardet is a character encoding detection module that is completely written in TypeScript. Its primary function is to determine the most probable encoding of a given input by leveraging occurrence analysis. The npm package is lightweight, with a packed size of only 22 KB, and does not contain any dependencies or native bindings. It has the ability to work in all environments including Node, browsers and native as well as on all platforms such as Linux, Mac and Windows.

How do you use chardet?

Chardet can be easily implemented in your JavaScript or TypeScript project. To start, you need to install the package via npm by running npm i chardet. Once installed, you can import it into your code using the import statement. The detect method can be used to return the encoding with the highest confidence.

Here is an example:

import chardet from 'chardet';

const encoding = chardet.detect(Buffer.from('hello there!'));
// or
const encoding = await chardet.detectFile('/path/to/file');
// or
const encoding = chardet.detectFileSync('/path/to/file');

To return the full list of possible encodings, you can use the analyse method:

import chardet from 'chardet';

chardet.analyse(Buffer.from('hello there!'));

For working with large data sets, you can specify parameters sampleSize and offset in the detectFile method.

chardet
  .detectFile('/path/to/file', { sampleSize: 32 })
  .then((encoding) => console.log(encoding));

chardet
  .detectFile('/path/to/file', { sampleSize: 32, offset: 128 })
  .then((encoding) => console.log(encoding));

Where are the chardet docs?

The complete documentation for chardet can be found within the npm package's readme file on its GitHub repository. It is comprehensive and provides a detailed overview of the module's functionality, its installation process, usage, methods, and supported encodings.