Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 19, 2024 via pnpm

iconv-lite 0.4.24

Convert character encodings in pure javascript.
Package summary
Share
0
issues
1
license
2
MIT
Package created
9 Nov 2011
Version published
22 Aug 2018
Maintainers
1
Total deps
2
Direct deps
1
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
2 Packages, Including:
iconv-lite@0.4.24
safer-buffer@2.1.2
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

1
All Dependencies CSV
β“˜ This is a list of iconv-lite 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
safer-buffer2.1.211.75 kBMIT
prod

Visualizations

Frequently Asked Questions

What does iconv-lite do?

Iconv-lite is a pure JavaScript library specialized in converting character encodings. It comes without the need for native code compilation, making it quick to install and ideal for use on Windows and sandboxed environments like Cloud9. This package is used in many popular projects such as Express.js (body_parser), Grunt, Nodemailer, Yeoman, and others. With its intuitive encode/decode API and streaming support, iconv-lite is renowned for being faster than node-iconv and supports in-browser usage via browserify or webpack.

How do you use iconv-lite?

In order to utilize iconv-lite, you'll first need to install it by using npm. Afterward, it's as simple as requiring 'iconv-lite' in your JavaScript file. It provides an API that allows you to encode and decode text using various character sets. For example, to convert from an encoded buffer to a JavaScript string, you could use the following code:

var iconv = require('iconv-lite');

// Convert from an encoded buffer to a js string.
str = iconv.decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251');

As for encoding from a JavaScript string to an encoded buffer, here is a code sample:

// Convert from a js string to an encoded buffer.
buf = iconv.encode("Sample input string", 'win1251');

Iconv-lite also supports the ability to check if a specific encoding is supported:

// Check if encoding is supported
iconv.encodingExists("us-ascii")

Iconv-lite even allows for streaming API usage:

// Decay stream (from binary data stream to js strings)
http.createServer(function(req, res) {
    var converterStream = iconv.decodeStream('win1251');
    req.pipe(converterStream);

    converterStream.on('data', function(str) {
        console.log(str); // Do something with decoded strings, chunk-by-chunk.
    });
});

Where are the iconv-lite docs?

For a complete guide to using Iconv-lite, you can find the documentation on GitHub at https://github.com/ashtuchkin/iconv-lite. This guide includes a comprehensive rundown of the usage, the API, all supported encodings, and additional details on UTF-16 and UTF-32 encoding handling, BOM handling, and more. Not to mention, it also includes instructions for testing, BOM handling information, and guides for encoding/decoding speeds.