Skip to content

Commit b7288df

Browse files
committedJun 8, 2020
Removed extendNodeEncodings mechanism. It didn't work in Node v4+ and was deprecated 5 years ago in v0.4.12.
1 parent 5148f43 commit b7288df

6 files changed

+2
-387
lines changed
 

‎README.md

-35
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* Faster than [node-iconv](https://github.com/bnoordhuis/node-iconv) (see below for performance comparison).
77
* Intuitive encode/decode API
88
* Streaming support for Node v0.10+
9-
* [Deprecated] Can extend Node.js primitives (buffers, streams) to support all iconv-lite encodings.
109
* In-browser usage via [Browserify](https://github.com/substack/node-browserify) (~180k gzip compressed with Buffer shim included).
1110
* Typescript [type definition file](https://github.com/ashtuchkin/iconv-lite/blob/master/lib/index.d.ts) included.
1211
* React Native is supported (need to explicitly `npm install` two more modules: `buffer` and `stream`).
@@ -61,40 +60,6 @@ http.createServer(function(req, res) {
6160
});
6261
```
6362

64-
### [Deprecated] Extend Node.js own encodings
65-
> NOTE: This doesn't work on latest Node versions. See [details](https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility).
66-
67-
```javascript
68-
// After this call all Node basic primitives will understand iconv-lite encodings.
69-
iconv.extendNodeEncodings();
70-
71-
// Examples:
72-
buf = new Buffer(str, 'win1251');
73-
buf.write(str, 'gbk');
74-
str = buf.toString('latin1');
75-
assert(Buffer.isEncoding('iso-8859-15'));
76-
Buffer.byteLength(str, 'us-ascii');
77-
78-
http.createServer(function(req, res) {
79-
req.setEncoding('big5');
80-
req.collect(function(err, body) {
81-
console.log(body);
82-
});
83-
});
84-
85-
fs.createReadStream("file.txt", "shift_jis");
86-
87-
// External modules are also supported (if they use Node primitives, which they probably do).
88-
request = require('request');
89-
request({
90-
url: "http://github.com/",
91-
encoding: "cp932"
92-
});
93-
94-
// To remove extensions
95-
iconv.undoExtendNodeEncodings();
96-
```
97-
9863
## Supported encodings
9964

10065
* All node.js native encodings: utf8, ucs2 / utf16-le, ascii, binary, base64, hex.

‎lib/extend-node.js

-217
This file was deleted.

‎lib/index.js

-3
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ if (nodeVer) {
143143
if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) {
144144
require("./streams")(iconv);
145145
}
146-
147-
// Load Node primitive extensions.
148-
require("./extend-node")(iconv);
149146
}
150147

151148
if ("Ā" != "\u0100") {

‎package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "iconv-lite",
33
"description": "Convert character encodings in pure javascript.",
4-
"version": "0.5.2",
4+
"version": "0.6.0-pre",
55
"license": "MIT",
66
"keywords": [
77
"iconv",
@@ -26,7 +26,6 @@
2626
"test": "mocha --reporter spec --grep ."
2727
},
2828
"browser": {
29-
"./lib/extend-node": false,
3029
"./lib/streams": false
3130
},
3231
"devDependencies": {

‎test/browserify-test.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ describe("Full Browserify tests", function() {
5151
assert.equal(browserIconvLite.encode("中国", 'gbk').toString('hex'), "d6d0b9fa");
5252
assert.equal(browserIconvLite.decode(new browserBuffer("d6d0b9fa", 'hex'), 'gbk'), "中国");
5353

54-
// Test that streaming and extend-node API-s are not present.
54+
// Test that streaming API-s are not present.
5555
assert(data.indexOf('encodeStream') == -1);
56-
assert(data.indexOf('extendNodeEncodings') == -1);
5756

5857
done();
5958
});

‎test/extend-node-test.js

-128
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.