Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5f6579d

Browse filesBrowse files
committed
buffer: remove raw & raws encoding
As `raw` and `raws` encodings are deprecated for such a long time, and they both are undocumented, this patch removes the support for those encodings completely. Previous discussion: #2829 PR-URL: #2859 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 9aa6a43 commit 5f6579d
Copy full SHA for 5f6579d

File tree

Expand file treeCollapse file tree

4 files changed

+3
-19
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+3
-19
lines changed
Open diff view settings
Collapse file

‎lib/buffer.js‎

Copy file name to clipboardExpand all lines: lib/buffer.js
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ Buffer.isEncoding = function(encoding) {
194194
case 'ucs-2':
195195
case 'utf16le':
196196
case 'utf-16le':
197-
case 'raw':
198197
return true;
199198

200199
default:
@@ -260,9 +259,6 @@ function byteLength(string, encoding) {
260259
switch (encoding) {
261260
case 'ascii':
262261
case 'binary':
263-
// Deprecated
264-
case 'raw':
265-
case 'raws':
266262
return len;
267263

268264
case 'utf8':
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
-12Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,18 +1217,6 @@ enum encoding ParseEncoding(const char* encoding,
12171217
return BUFFER;
12181218
} else if (strcasecmp(encoding, "hex") == 0) {
12191219
return HEX;
1220-
} else if (strcasecmp(encoding, "raw") == 0) {
1221-
if (!no_deprecation) {
1222-
fprintf(stderr, "'raw' (array of integers) has been removed. "
1223-
"Use 'binary'.\n");
1224-
}
1225-
return BINARY;
1226-
} else if (strcasecmp(encoding, "raws") == 0) {
1227-
if (!no_deprecation) {
1228-
fprintf(stderr, "'raws' encoding has been renamed to 'binary'. "
1229-
"Please update your code.\n");
1230-
}
1231-
return BINARY;
12321220
} else {
12331221
return default_encoding;
12341222
}
Collapse file

‎test/parallel/test-buffer-bytelength.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-buffer-bytelength.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ var assert = require('assert');
55
var Buffer = require('buffer').Buffer;
66

77
// coerce values to string
8-
assert.equal(Buffer.byteLength(32, 'raw'), 2);
8+
assert.equal(Buffer.byteLength(32, 'binary'), 2);
99
assert.equal(Buffer.byteLength(NaN, 'utf8'), 3);
10-
assert.equal(Buffer.byteLength({}, 'raws'), 15);
10+
assert.equal(Buffer.byteLength({}, 'binary'), 15);
1111
assert.equal(Buffer.byteLength(), 9);
1212

1313
// special case: zero length string
Collapse file

‎test/parallel/test-file-read-noexist.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-file-read-noexist.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var fs = require('fs');
66
var got_error = false;
77

88
var filename = path.join(common.fixturesDir, 'does_not_exist.txt');
9-
fs.readFile(filename, 'raw', function(err, content) {
9+
fs.readFile(filename, 'binary', function(err, content) {
1010
if (err) {
1111
got_error = true;
1212
} else {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.