Skip to content

Commit

Permalink
replace deprecated Buffer constructor (#3305)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Aug 29, 2018
1 parent a84358d commit 9a80ac9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/less.js
Original file line number Diff line number Diff line change
Expand Up @@ -13972,7 +13972,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
} else {
var bytes = Buffer.isBuffer(val)
? val
: new Buffer(val, encoding)
: Buffer.from(val, encoding)
var len = bytes.length
for (i = 0; i < end - start; ++i) {
this[i + start] = bytes[i % len]
Expand Down Expand Up @@ -14251,7 +14251,7 @@ function clone(parent, circular, depth, prototype, includeNonEnumerable) {
child = Buffer.allocUnsafe(parent.length);
} else {
// Older Node.js versions
child = new Buffer(parent.length);
child = Buffer.alloc(parent.length);
}
parent.copy(child);
return child;
Expand Down
2 changes: 1 addition & 1 deletion lib/less-node/environment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
encodeBase64: function encodeBase64(str) {
return new Buffer(str).toString('base64');
return Buffer.from(str).toString('base64');
},
mimeLookup: function (filename) {
return require('mime').lookup(filename);
Expand Down
2 changes: 1 addition & 1 deletion test/copy-bom.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function() {
fs = require('fs');

var BUF_LENGTH = 64 * 1024;
var _buff = new Buffer(BUF_LENGTH);
var _buff = Buffer.alloc(BUF_LENGTH);

function copyFolderWithBom(src, dest) {
var stats = fs.lstatSync(src);
Expand Down

0 comments on commit 9a80ac9

Please sign in to comment.