Character encoding detection module for NodeJS, written in pure JavaScript (TypeScript). It can detect the most probable encoding from a Buffer or Uint8Array, or analyze a file to return a confidence-sorted list of possible encodings, useful when you need to interpret unknown text encodings in Node or browser environments.
Project status
- Actively maintained, with very recent activity (last upstream push on 2026-08-01) and the latest tagged update v2.2.0 on 2026-06-20.
- Apparent update cadence is currently steady for a project of this size, roughly every 8 months between v2.1.1 (2025-10-29) and v2.2.0 (2026-06-20), plus additional upstream commits after the v2.2.0 tag.
AI summary generated
Recent updates
v2.2.0
v2.2.0 documents adding support for the Windows-1257 and Windows-1258 single-byte encodings. The code diff shows additional encoding support (Windows-874) and also a broader internal tooling change (switch from Jest to Vitest, updated TS build configuration and CI Node versions).
Featuresv2.1.1
v2.1.1 contains bug fixes related to reading file samples for character detection, plus build and release workflow updates. The code changes focus on safer handling of partially-read buffers when sampleSize is larger than the available file data, and modernizing CI tooling.
v2.1.0
v2.1.0 primarily introduces a new TypeScript type, EncodingName, to represent the library's supported encoding names. The implementation updates the TypeScript typings across recognizers and match results to use this stricter union type, and it exports EncodingName (and Match) from the package entry point.
Featuresv2.0.0
Version 2.0.0 introduces stricter input validation for chardet detection. Only byte-array-like inputs are accepted, and non-byte inputs (such as strings) are no longer supported. A related breaking change was also undone via a bug fix, but the main behavior change is the new input rules.
BreakingFeaturesv1.6.1
v1.6.1 contains a targeted bug fix to add runtime input validation so only byte-array like inputs are accepted, and it adds a small test suite for the new helper. The release also includes several repository and documentation maintenance changes (CI workflow action pinning, Prettier updates, and a README example).
Securityv1.6.0
v1.6.0 adds support for detecting the ASCII character set by introducing a new ASCII recogniser and wiring it into the main recogniser list. The release also updates tests/expected outputs and makes a few CI/tooling adjustments (Node.js and dev dependency bumps).
Featuresv1.5.1
Release v1.5.1 makes small TypeScript typing changes and upgrades parts of the repository tooling. The code diff shows additional type export and a change to the meaning of the DetectResult type beyond what the release notes describe.
v1.5.0
v1.5.0 introduces an option to specify a byte offset when reading files for encoding detection. The release also updates tests and README to cover the new offset option. In the underlying implementation, additional (not release-noted) changes touch core read logic, CI/test tooling, and parts of the encoding recognizers.
Featuresv1.4.0
v1.4.0 claims language detection improvements. The code changes also include a non-trivial internal refactor of how detection state (Context) is represented and how match results compute the returned language value.
BreakingFeaturesv1.3.0
v1.3.0 adds browser compatibility for node-chardet. The release notes only mention making the module work in the browser, but the code diff shows additional TypeScript typing changes and environment/build changes.
Features