Skip to content

Commit e6ce277

Browse files
authored
Replace deprecated Node Buffer constructor (#3126)
1 parent 422ee45 commit e6ce277

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

platform/node/test/js/map.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ test('Map', function(t) {
199199
var map = new mbgl.Map(options);
200200

201201
t.throws(function() {
202-
map.addImage('foo', new Buffer(''), {
202+
map.addImage('foo', Buffer.from(''), {
203203
width: 401,
204204
height: 400,
205205
pixelRatio: 1
@@ -214,7 +214,7 @@ test('Map', function(t) {
214214
var map = new mbgl.Map(options);
215215

216216
t.throws(function() {
217-
map.addImage('foo', new Buffer(''), {
217+
map.addImage('foo', Buffer.from(''), {
218218
width: 1025,
219219
height: 1025,
220220
pixelRatio: 1
@@ -230,7 +230,7 @@ test('Map', function(t) {
230230
var map = new mbgl.Map(options);
231231

232232
t.throws(function() {
233-
map.addImage('foo', new Buffer(' '), {
233+
map.addImage('foo', Buffer.from(' '), {
234234
width: 401,
235235
height: 400,
236236
pixelRatio: 1
@@ -245,7 +245,7 @@ test('Map', function(t) {
245245
var map = new mbgl.Map(options);
246246

247247
t.doesNotThrow(function() {
248-
map.addImage('foo', new Buffer(' '), {
248+
map.addImage('foo', Buffer.from(' '), {
249249
width: 1,
250250
height: 1,
251251
pixelRatio: 1

test/fixtures/sprites/convert_sprite.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var zlib = require('zlib');
77
var PNG = require('png-js');
88
var png = PNG.load('styles/sprites/bright.png');
99
png.decodePixels(function(data) {
10-
var result = new Buffer(8 + data.length);
10+
var result = Buffer.alloc(8 + data.length);
1111
result.writeUInt32BE(png.width, 0);
1212
result.writeUInt32BE(png.height, 4);
1313
data.copy(result, 8);

0 commit comments

Comments
 (0)