Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Buffer usage #1335

Merged
merged 1 commit into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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