Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
lib/ | 12-May-2024 | - | 129 | 76 | ||
test/ | 12-May-2024 | - | 76 | 63 | ||
.npmignore | D | 12-May-2024 | 12 | 1 | 1 | |
.travis.yml | D | 12-May-2024 | 505 | 26 | 25 | |
LICENSE | D | 12-May-2024 | 935 | 17 | 14 | |
README.md | D | 12-May-2024 | 1.4 KiB | 53 | 32 | |
package.json | D | 12-May-2024 | 1.4 KiB | 55 | 54 |
README.md
1# Encoding 2 3**encoding** is a simple wrapper around [node-iconv](https://github.com/bnoordhuis/node-iconv) and [iconv-lite](https://github.com/ashtuchkin/iconv-lite/) to convert strings from one encoding to another. If node-iconv is not available for some reason, 4iconv-lite will be used instead of it as a fallback. 5 6[](http://travis-ci.org/andris9/Nodemailer) 7[](http://badge.fury.io/js/encoding) 8 9## Install 10 11Install through npm 12 13 npm install encoding 14 15## Usage 16 17Require the module 18 19 var encoding = require("encoding"); 20 21Convert with encoding.convert() 22 23 var resultBuffer = encoding.convert(text, toCharset, fromCharset); 24 25Where 26 27 * **text** is either a Buffer or a String to be converted 28 * **toCharset** is the characterset to convert the string 29 * **fromCharset** (*optional*, defaults to UTF-8) is the source charset 30 31Output of the conversion is always a Buffer object. 32 33Example 34 35 var result = encoding.convert("ÕÄÖÜ", "Latin_1"); 36 console.log(result); //<Buffer d5 c4 d6 dc> 37 38## iconv support 39 40By default only iconv-lite is bundled. If you need node-iconv support, you need to add it 41as an additional dependency for your project: 42 43 ..., 44 "dependencies":{ 45 "encoding": "*", 46 "iconv": "*" 47 }, 48 ... 49 50## License 51 52**MIT** 53