Skip to content

Commit

Permalink
Fix deprecated Buffer constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
polygonplanet committed Feb 19, 2022
1 parent 0593cac commit b8fda07
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('Encoding', function() {

var jisx0208 = fs.readFileSync(__dirname + '/jis-x-0208-utf8.txt');
var jisx0208Len = jisx0208.length + 1;
tests.jisx0208 = new Buffer(jisx0208Len);
tests.jisx0208 = Buffer.alloc(jisx0208Len);
// Prepend an ascii character for UTF-16 detection.
tests.jisx0208[0] = 'a'.charCodeAt(0);
for (i = 1; i < jisx0208Len; i++) {
Expand Down Expand Up @@ -1119,7 +1119,7 @@ describe('Encoding', function() {
assert(encoded.length === 2);
assert(Array.isArray(encoded));

var buffer = new Buffer(0);
var buffer = Buffer.alloc(0);
encoded = encoding.convert(buffer, {
to: 'utf-8',
from: 'unicode',
Expand All @@ -1128,7 +1128,7 @@ describe('Encoding', function() {
assert(encoded.length === 0);
assert(Array.isArray(encoded));

buffer = new Buffer(2);
buffer = Buffer.alloc(2);
buffer[0] = 0x61;
buffer[1] = 0x62;
encoded = encoding.convert(buffer, {
Expand Down Expand Up @@ -1209,7 +1209,7 @@ describe('Encoding', function() {
assert(encoded.length === 2);
assert(isTypedArray(encoded));

var buffer = new Buffer(0);
var buffer = Buffer.alloc(0);
encoded = encoding.convert(buffer, {
to: 'utf-8',
from: 'unicode',
Expand All @@ -1218,7 +1218,7 @@ describe('Encoding', function() {
assert(encoded.length === 0);
assert(isTypedArray(encoded));

buffer = new Buffer(2);
buffer = Buffer.alloc(2);
buffer[0] = 0x61;
buffer[1] = 0x62;
encoded = encoding.convert(buffer, {
Expand Down Expand Up @@ -1299,7 +1299,7 @@ describe('Encoding', function() {
assert(encoded.length === 2);
assert(isString(encoded));

var buffer = new Buffer(0);
var buffer = Buffer.alloc(0);
encoded = encoding.convert(buffer, {
to: 'utf-8',
from: 'unicode',
Expand All @@ -1308,7 +1308,7 @@ describe('Encoding', function() {
assert(encoded.length === 0);
assert(isString(encoded));

buffer = new Buffer(2);
buffer = Buffer.alloc(2);
buffer[0] = 0x61;
buffer[1] = 0x62;
encoded = encoding.convert(buffer, {
Expand Down

0 comments on commit b8fda07

Please sign in to comment.