jack e1a2621c78 update | hace 2 años | |
---|---|---|
.. | ||
encodings | hace 2 años | |
generation | hace 2 años | |
test | hace 2 años | |
.npmignore | hace 2 años | |
.travis.yml | hace 2 años | |
LICENSE | hace 2 años | |
README.md | hace 2 años | |
README.md~ | hace 2 años | |
index.js | hace 2 años | |
package.json | hace 2 años |
var iconv = require('iconv-lite');
// Convert from an encoded buffer to string.
str = iconv.decode(buf, 'win1251');
// Convert from string to an encoded buffer.
buf = iconv.encode("Sample input string", 'win1251');
// Check if encoding is supported
iconv.encodingExists("us-ascii")
Others are easy to add, see the source. Please, participate. Most encodings are generated from node-iconv. Thank you Ben Noordhuis and iconv authors!
Not supported yet: EUC family, Shift_JIS.
Comparison with node-iconv module (1000x256kb, on Ubuntu 12.04, Core i5/2.5 GHz, Node v0.8.7). Note: your results may vary, so please always check on your hardware.
operation iconv@1.2.4 iconv-lite@0.2.4
----------------------------------------------------------
encode('win1251') ~115 Mb/s ~230 Mb/s
decode('win1251') ~95 Mb/s ~130 Mb/s
When decoding, a 'binary'-encoded string can be used as a source buffer.
Untranslatable characters are set to � or ?. No transliteration is currently supported, pull requests are welcome.
git clone git@github.com:ashtuchkin/iconv-lite.git
cd iconv-lite
npm install
npm test
# To view performance:
node test/performance.js