Skip to content

Commit

Permalink
Replace deprecated Node Buffer constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
kudlav authored and acalcutt committed Jan 17, 2025
1 parent 42490d5 commit 5d6be6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions platform/node/test/js/map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ test('Map', function(t) {
var map = new mbgl.Map(options);

t.throws(function() {
map.addImage('foo', new Buffer(''), {
map.addImage('foo', Buffer.from(''), {
width: 401,
height: 400,
pixelRatio: 1
Expand All @@ -214,7 +214,7 @@ test('Map', function(t) {
var map = new mbgl.Map(options);

t.throws(function() {
map.addImage('foo', new Buffer(''), {
map.addImage('foo', Buffer.from(''), {
width: 1025,
height: 1025,
pixelRatio: 1
Expand All @@ -230,7 +230,7 @@ test('Map', function(t) {
var map = new mbgl.Map(options);

t.throws(function() {
map.addImage('foo', new Buffer(' '), {
map.addImage('foo', Buffer.from(' '), {
width: 401,
height: 400,
pixelRatio: 1
Expand All @@ -245,7 +245,7 @@ test('Map', function(t) {
var map = new mbgl.Map(options);

t.doesNotThrow(function() {
map.addImage('foo', new Buffer(' '), {
map.addImage('foo', Buffer.from(' '), {
width: 1,
height: 1,
pixelRatio: 1
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/sprites/convert_sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var zlib = require('zlib');
var PNG = require('png-js');
var png = PNG.load('styles/sprites/bright.png');
png.decodePixels(function(data) {
var result = new Buffer(8 + data.length);
var result = Buffer.alloc(8 + data.length);
result.writeUInt32BE(png.width, 0);
result.writeUInt32BE(png.height, 4);
data.copy(result, 8);
Expand Down

0 comments on commit 5d6be6f

Please sign in to comment.