Skip to content

Commit 5f6579d

Browse 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

4 files changed

Lines changed: 3 additions & 19 deletions

File tree

‎lib/buffer.js‎

Lines 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
returntrue;
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
returnlen;
267263

268264
case'utf8':

‎src/node.cc‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,18 +1217,6 @@ enum encoding ParseEncoding(const char* encoding,
12171217
returnBUFFER;
12181218
} elseif (strcasecmp(encoding, "hex") == 0) {
12191219
returnHEX;
1220-
} elseif (strcasecmp(encoding, "raw") == 0) {
1221-
if (!no_deprecation) {
1222-
fprintf(stderr, "'raw' (array of integers) has been removed. "
1223-
"Use 'binary'.\n");
1224-
}
1225-
returnBINARY;
1226-
} elseif (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-
returnBINARY;
12321220
} else {
12331221
return default_encoding;
12341222
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ var assert = require('assert');
55
varBuffer=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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var fs = require('fs');
66
vargot_error=false;
77

88
varfilename=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)