Skip to content

Commit 2be875c

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 73d1e29 commit 2be875c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/generators/app/index.js

Lines changed: 3 additions & 3 deletions
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
]);
@@ -545,7 +545,7 @@ export class Generator extends Base {
545545
}),
546546
tap(file => {
547547
const contents = pugReplacer(file.contents.toString());
548-
file.contents = new Buffer(contents);
548+
file.contents = Buffer.from(contents);
549549
}),
550550
pugFilter.restore
551551
]);

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

Lines changed: 1 addition & 1 deletion
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')

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

Lines changed: 1 addition & 1 deletion
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)