Merge pull request #9801 from yungRoz/replace-deprecated-buffer-constructor

Replace deprecated `new Buffer(string, 'base64')` constructor with `Buffer.from(string, 'base64')
This commit is contained in:
Tim van der Meij 2018-06-13 23:03:51 +02:00 committed by GitHub
commit b590519ea2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ function runTtx(ttxResourcesHome, fontPath, registerOnCancel, callback) {
exports.translateFont = function translateFont(content, registerOnCancel,
callback) {
var buffer = new Buffer(content, 'base64');
var buffer = Buffer.from(content, 'base64');
var taskId = (nextTTXTaskId++).toString();
var fontPath = path.join(ttxResourcesHome, taskId + '.otf');
var resultPath = path.join(ttxResourcesHome, taskId + '.ttx');

View File

@ -320,7 +320,7 @@ function checkEq(task, results, browser, masterMode) {
}
var testSnapshot = pageResults[page].snapshot;
if (testSnapshot && testSnapshot.indexOf('data:image/png;base64,') === 0) {
testSnapshot = new Buffer(testSnapshot.substring(22), 'base64');
testSnapshot = Buffer.from(testSnapshot.substring(22), 'base64');
} else {
console.error('Valid snapshot was not found.');
}