Gathering detailed insights and metrics for whatwg-encoding
Gathering detailed insights and metrics for whatwg-encoding
Gathering detailed insights and metrics for whatwg-encoding
Gathering detailed insights and metrics for whatwg-encoding
@types/whatwg-encoding
TypeScript definitions for whatwg-encoding
utf8-encoding
utf8 encoder/decoder of whatwg Encoding Living Standard https://encoding.spec.whatwg.org/
whatwg-encoding-mapper
Encoding mapper according to the WHATWG Encoding Standard
@i-xi-dev/ms932-encoder
A JavaScript Windows-31J encoder, implements Shift_JIS encoder defined in WHATWG Encoding Standard.
Decode strings according to the WHATWG Encoding Standard
npm install whatwg-encoding
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
25 Stars
30 Commits
10 Forks
4 Watchers
2 Branches
9 Contributors
Updated on May 30, 2025
Latest Version
3.1.1
Package Id
whatwg-encoding@3.1.1
Unpacked Size
13.03 kB
Size
4.12 kB
File Count
6
NPM Version
10.2.0
Node Version
21.1.0
Published on
Nov 12, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
2
This package provides a thin layer on top of iconv-lite which makes it expose some of the same primitives as the Encoding Standard.
1const whatwgEncoding = require("whatwg-encoding"); 2 3console.assert(whatwgEncoding.labelToName("latin1") === "windows-1252"); 4console.assert(whatwgEncoding.labelToName(" CYRILLic ") === "ISO-8859-5"); 5 6console.assert(whatwgEncoding.isSupported("IBM866") === true); 7 8// Not supported by the Encoding Standard 9console.assert(whatwgEncoding.isSupported("UTF-32") === false); 10 11// In the Encoding Standard, but this package can't decode it 12console.assert(whatwgEncoding.isSupported("x-mac-cyrillic") === false); 13 14console.assert(whatwgEncoding.getBOMEncoding(new Uint8Array([0xFE, 0xFF])) === "UTF-16BE"); 15console.assert(whatwgEncoding.getBOMEncoding(new Uint8Array([0x48, 0x69])) === null); 16 17console.assert(whatwgEncoding.decode(new Uint8Array([0x48, 0x69]), "UTF-8") === "Hi");
decode(uint8Array, fallbackEncodingName)
: performs the decode algorithm (in which any BOM will override the passed fallback encoding), and returns the resulting stringlabelToName(label)
: performs the get an encoding algorithm and returns the resulting encoding's name, or null
for failureisSupported(name)
: returns whether the encoding is one of the encodings of the Encoding Standard, and is an encoding that this package can decode (via iconv-lite)getBOMEncoding(uint8Array)
: sniffs the first 2–3 bytes of the supplied Uint8Array
, returning one of the encoding names "UTF-8"
, "UTF-16LE"
, or "UTF-16BE"
if the appropriate BOM is present, or null
if no BOM is presentSince we rely on iconv-lite, we are limited to support only the encodings that they support. Currently we are missing support for:
Passing these encoding names will return false
when calling isSupported
, and passing any of the possible labels for these encodings to labelToName
will return null
.
This package was originally based on the excellent work of @nicolashenry, in jsdom. It has since been pulled out into this separate package.
If you are looking for a JavaScript implementation of the Encoding Standard's TextEncoder
and TextDecoder
APIs, you'll want @inexorabletash's text-encoding package. Node.js also has them built-in.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 4/26 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More