Gathering detailed insights and metrics for whatwg-encoding-mapper
Gathering detailed insights and metrics for whatwg-encoding-mapper
Gathering detailed insights and metrics for whatwg-encoding-mapper
Gathering detailed insights and metrics for whatwg-encoding-mapper
npm install whatwg-encoding-mapper
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
16 Commits
1 Watching
1 Branches
1 Contributors
Updated on 25 Mar 2020
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
0%
2
Compared to previous day
Last week
850%
19
Compared to previous week
Last month
110.6%
99
Compared to previous month
Last year
-32.3%
1,229
Compared to previous year
4
1npm i whatwg-encoding-mapper
This package is a fork of whatwg-encoding which remove the iconv-lite
and decode method. Only gave the mapping in the Encoding Standard.
Data is from https://encoding.spec.whatwg.org/encodings.json
1const whatwgEncoding = require("whatwg-encoding-mapper");
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(Buffer.from([0xFE, 0xFF])) === "UTF-16BE");
15console.assert(whatwgEncoding.getBOMEncoding(Buffer.from([0x48, 0x69])) === null);
labelToName(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(buffer)
: sniffs the first 2–3 bytes of the supplied Buffer
, 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 presentif you use iconv-lite
out of this package. check the document for updated and more accurate result.
supportedName list is generated using the iconv-lite
in devDependencies
setction in package.json
whatwg-encoding
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.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/16 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
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