diff --git a/controllers/scriptStorage.js b/controllers/scriptStorage.js index f1cd3099d..3e0cf311f 100644 --- a/controllers/scriptStorage.js +++ b/controllers/scriptStorage.js @@ -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); @@ -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) { diff --git a/controllers/user.js b/controllers/user.js index 17646491f..55873c517 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -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) { diff --git a/libs/githubClient.js b/libs/githubClient.js index 5bb92f97e..20c058b27 100644 --- a/libs/githubClient.js +++ b/libs/githubClient.js @@ -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); diff --git a/libs/repoManager.js b/libs/repoManager.js index 7ec4d33f4..dd9b20073 100644 --- a/libs/repoManager.js +++ b/libs/repoManager.js @@ -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) {