Skip to content

Commit

Permalink
Migrate Buffer usage (#1335)
Browse files Browse the repository at this point in the history
Applies to nodejs/node#19079 and initially referenced in da49fff

Auto-merge
  • Loading branch information
Martii authored Mar 2, 2018
1 parent da49fff commit bfa60bd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions controllers/scriptStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ exports.getSource = function (aReq, aCallback) {
} else {
bufferStream = new stream.PassThrough();

bufferStream.end(new Buffer(aData.Body));
bufferStream.end(Buffer.from(aData.Body));

// Get the script
aCallback(aScript, bufferStream);
Expand Down Expand Up @@ -1441,7 +1441,7 @@ exports.storeScript = function (aUser, aMeta, aBuf, aUpdate, aCallback) {
return;
}

buffer = new Buffer(data, 'base64');
buffer = Buffer.from(data, 'base64');
try {
dimensions = sizeOf(buffer);
} catch (aE) {
Expand Down
2 changes: 1 addition & 1 deletion controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ exports.submitSource = function (aReq, aRes, aNext) {
});
}

source = new Buffer(aReq.body.source);
source = Buffer.from(aReq.body.source);
uri = aReq.body.url;

if (isLib) {
Expand Down
2 changes: 1 addition & 1 deletion libs/githubClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var githubGitDataGetBlobAsUtf8 = function (aMsg, aCallback) {
function (aBlob, aCallback) {
var content = aBlob.content;
if (aBlob.encoding === 'base64') {
var buf = new Buffer(content, 'base64');
var buf = Buffer.from(content, 'base64');
content = buf.toString('utf8');
}
aCallback(null, content);
Expand Down
2 changes: 1 addition & 1 deletion libs/repoManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function fetchRaw(aHost, aPath, aCallback) {
var bufs = [];
if (aRes.statusCode !== 200) {
console.warn(aRes.statusCode);
return aCallback([new Buffer('')]);
return aCallback([Buffer.from('')]);
}
else {
aRes.on('data', function (aData) {
Expand Down

0 comments on commit bfa60bd

Please sign in to comment.