Skip to content

Commit e85eb48

Browse files
Awk34zeripath
authored andcommitted
chore(server): migrate from new Buffer to Buffer.from
new Buffer(...) has been deprecated since node v6.0.0 and Buffer.from methods should used instead Fixes #2753
1 parent 9524734 commit e85eb48

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Diff for: src/generators/app/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ export class Generator extends Base {
471471
.toSource();
472472
}
473473

474-
file.contents = new Buffer(contents);
474+
file.contents = Buffer.from(contents);
475475
});
476476

477477
let clientJsFilter = filter(['client/**/*.js'], {restore: true});
@@ -508,7 +508,7 @@ export class Generator extends Base {
508508
tap(function(file, t) {
509509
var contents = file.contents.toString();
510510
contents = replacer(contents);
511-
file.contents = new Buffer(contents);
511+
file.contents = Buffer.from(contents);
512512
}),
513513
tsFilter.restore
514514
]);
@@ -546,7 +546,7 @@ export class Generator extends Base {
546546
}),
547547
tap(file => {
548548
const contents = pugReplacer(file.contents.toString());
549-
file.contents = new Buffer(contents);
549+
file.contents = Buffer.from(contents);
550550
}),
551551
pugFilter.restore
552552
]);

Diff for: templates/app/server/api/user(auth)/user.model(mongooseModels).js

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ UserSchema.methods = {
241241

242242
var defaultIterations = 10000;
243243
var defaultKeyLength = 64;
244-
var salt = new Buffer(this.salt, 'base64');
244+
var salt = Buffer.from(this.salt, 'base64');
245245

246246
if(!callback) {
247247
return crypto.pbkdf2Sync(password, salt, defaultIterations, defaultKeyLength, 'sha256')

Diff for: templates/app/server/api/user(auth)/user.model(sequelizeModels).js

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export default function(sequelize, DataTypes) {
171171

172172
var defaultIterations = 10000;
173173
var defaultKeyLength = 64;
174-
var salt = new Buffer(this.salt, 'base64');
174+
var salt = Buffer.from(this.salt, 'base64');
175175

176176
if(!callback) {
177177
return crypto.pbkdf2Sync(password, salt, defaultIterations, defaultKeyLength, 'sha256')

0 commit comments

Comments
 (0)