Skip to content

Commit bfa60bd

Browse files
authoredMar 2, 2018
Migrate Buffer usage (#1335)
Applies to nodejs/node#19079 and initially referenced in da49fff Auto-merge
1 parent da49fff commit bfa60bd

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed
 

‎controllers/scriptStorage.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ exports.getSource = function (aReq, aCallback) {
359359
} else {
360360
bufferStream = new stream.PassThrough();
361361

362-
bufferStream.end(new Buffer(aData.Body));
362+
bufferStream.end(Buffer.from(aData.Body));
363363

364364
// Get the script
365365
aCallback(aScript, bufferStream);
@@ -1441,7 +1441,7 @@ exports.storeScript = function (aUser, aMeta, aBuf, aUpdate, aCallback) {
14411441
return;
14421442
}
14431443

1444-
buffer = new Buffer(data, 'base64');
1444+
buffer = Buffer.from(data, 'base64');
14451445
try {
14461446
dimensions = sizeOf(buffer);
14471447
} catch (aE) {

‎controllers/user.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ exports.submitSource = function (aReq, aRes, aNext) {
16511651
});
16521652
}
16531653

1654-
source = new Buffer(aReq.body.source);
1654+
source = Buffer.from(aReq.body.source);
16551655
uri = aReq.body.url;
16561656

16571657
if (isLib) {

‎libs/githubClient.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var githubGitDataGetBlobAsUtf8 = function (aMsg, aCallback) {
4949
function (aBlob, aCallback) {
5050
var content = aBlob.content;
5151
if (aBlob.encoding === 'base64') {
52-
var buf = new Buffer(content, 'base64');
52+
var buf = Buffer.from(content, 'base64');
5353
content = buf.toString('utf8');
5454
}
5555
aCallback(null, content);

‎libs/repoManager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function fetchRaw(aHost, aPath, aCallback) {
4545
var bufs = [];
4646
if (aRes.statusCode !== 200) {
4747
console.warn(aRes.statusCode);
48-
return aCallback([new Buffer('')]);
48+
return aCallback([Buffer.from('')]);
4949
}
5050
else {
5151
aRes.on('data', function (aData) {

0 commit comments

Comments
 (0)
Please sign in to comment.