Gathering detailed insights and metrics for iconv-lite
Gathering detailed insights and metrics for iconv-lite
Gathering detailed insights and metrics for iconv-lite
Gathering detailed insights and metrics for iconv-lite
npm install iconv-lite
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
3,123 Stars
283 Commits
289 Forks
62 Watchers
4 Branches
34 Contributors
Updated on Jul 11, 2025
Latest Version
0.6.3
Package Id
iconv-lite@0.6.3
Size
186.20 kB
NPM Version
7.6.1
Node Version
15.6.0
Published on
May 24, 2021
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
stream
module to enable Streaming API).1var iconv = require('iconv-lite'); 2 3// Convert from an encoded buffer to a js string. 4str = iconv.decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251'); 5 6// Convert from a js string to an encoded buffer. 7buf = iconv.encode("Sample input string", 'win1251'); 8 9// Check if encoding is supported 10iconv.encodingExists("us-ascii")
1 2// Decode stream (from binary data stream to js strings) 3http.createServer(function(req, res) { 4 var converterStream = iconv.decodeStream('win1251'); 5 req.pipe(converterStream); 6 7 converterStream.on('data', function(str) { 8 console.log(str); // Do something with decoded strings, chunk-by-chunk. 9 }); 10}); 11 12// Convert encoding streaming example 13fs.createReadStream('file-in-win1251.txt') 14 .pipe(iconv.decodeStream('win1251')) 15 .pipe(iconv.encodeStream('ucs2')) 16 .pipe(fs.createWriteStream('file-in-ucs2.txt')); 17 18// Sugar: all encode/decode streams have .collect(cb) method to accumulate data. 19http.createServer(function(req, res) { 20 req.pipe(iconv.decodeStream('win1251')).collect(function(err, body) { 21 assert(typeof body == 'string'); 22 console.log(body); // full request body string 23 }); 24});
See all supported encodings on wiki.
Most singlebyte encodings are generated automatically from node-iconv. Thank you Ben Noordhuis and libiconv authors!
Multibyte encodings are generated from Unicode.org mappings and WHATWG Encoding Standard mappings. Thank you, respective authors!
Comparison with node-iconv module (1000x256kb, on MacBook Pro, Core i5/2.6 GHz, Node v0.12.0). Note: your results may vary, so please always check on your hardware.
operation iconv@2.1.4 iconv-lite@0.4.7
----------------------------------------------------------
encode('win1251') ~96 Mb/s ~320 Mb/s
decode('win1251') ~95 Mb/s ~246 Mb/s
stripBOM: false
in options
(f.ex. iconv.decode(buf, enc, {stripBOM: false})
).
A callback might also be given as a stripBOM
parameter - it'll be called if BOM character was actually found.addBOM: true
option.This library supports UTF-16LE, UTF-16BE and UTF-16 encodings. First two are straightforward, but UTF-16 is trying to be smart about endianness in the following ways:
defaultEncoding: 'utf-16be'
option. Strips BOM unless stripBOM: false
.addBOM: false
to override.This library supports UTF-32LE, UTF-32BE and UTF-32 encodings. Like the UTF-16 encoding above, UTF-32 defaults to UTF-32LE, but uses BOM and 'spaces heuristics' to determine input endianness.
defaultEncoding: 'utf-32be'
option. Strips BOM unless stripBOM: false
.addBOM: false
to override. (defaultEncoding: 'utf-32be'
can also be used here to change encoding.)When decoding, be sure to supply a Buffer to decode() method, otherwise bad things usually happen.
Untranslatable characters are set to � or ?. No transliteration is currently supported.
Node versions 0.10.31 and 0.11.13 are buggy, don't use them (see #65, #77).
1$ git clone git@github.com:ashtuchkin/iconv-lite.git 2$ cd iconv-lite 3$ npm install 4$ npm test 5 6$ # To view performance: 7$ node test/performance.js 8 9$ # To view test coverage: 10$ npm run coverage 11$ open coverage/lcov-report/index.html
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 5/30 approved changesets -- score normalized to 1
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
security policy file not detected
Details
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