Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffer: remove raw & raws encoding #2859

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ Buffer.isEncoding = function(encoding) {
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
case 'raw':
return true;

default:
Expand Down Expand Up @@ -250,9 +249,6 @@ function byteLength(string, encoding) {
switch (encoding) {
case 'ascii':
case 'binary':
// Deprecated
case 'raw':
case 'raws':
return len;

case 'utf8':
Expand Down
12 changes: 0 additions & 12 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1205,18 +1205,6 @@ enum encoding ParseEncoding(const char* encoding,
return BUFFER;
} else if (strcasecmp(encoding, "hex") == 0) {
return HEX;
} else if (strcasecmp(encoding, "raw") == 0) {
if (!no_deprecation) {
fprintf(stderr, "'raw' (array of integers) has been removed. "
"Use 'binary'.\n");
}
return BINARY;
} else if (strcasecmp(encoding, "raws") == 0) {
if (!no_deprecation) {
fprintf(stderr, "'raws' encoding has been renamed to 'binary'. "
"Please update your code.\n");
}
return BINARY;
} else {
return default_encoding;
}
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-buffer-bytelength.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ var assert = require('assert');
var Buffer = require('buffer').Buffer;

// coerce values to string
assert.equal(Buffer.byteLength(32, 'raw'), 2);
assert.equal(Buffer.byteLength(32, 'binary'), 2);
assert.equal(Buffer.byteLength(NaN, 'utf8'), 3);
assert.equal(Buffer.byteLength({}, 'raws'), 15);
assert.equal(Buffer.byteLength({}, 'binary'), 15);
assert.equal(Buffer.byteLength(), 9);

// special case: zero length string
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-file-read-noexist.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var fs = require('fs');
var got_error = false;

var filename = path.join(common.fixturesDir, 'does_not_exist.txt');
fs.readFile(filename, 'raw', function(err, content) {
fs.readFile(filename, 'binary', function(err, content) {
if (err) {
got_error = true;
} else {
Expand Down