Remove Buffer() deprecation notice (#5942)

This commit is contained in:
Antonio Davi Macedo Coelho de Castro
2019-08-18 23:22:44 -07:00
committed by Diamond Lewis
parent f25a846c3e
commit c4e016e5de
2 changed files with 3 additions and 3 deletions

View File

@@ -1544,7 +1544,7 @@ var BytesCoder = {
}, },
JSONToDatabase(json) { JSONToDatabase(json) {
return new mongodb.Binary(new Buffer(json.base64, 'base64')); return new mongodb.Binary(Buffer.from(json.base64, 'base64'));
}, },
isValidJSON(value) { isValidJSON(value) {

View File

@@ -105,7 +105,7 @@ export function handleParseHeaders(req, res, next) {
if (fileViaJSON) { if (fileViaJSON) {
// We need to repopulate req.body with a buffer // We need to repopulate req.body with a buffer
var base64 = req.body.base64; var base64 = req.body.base64;
req.body = new Buffer(base64, 'base64'); req.body = Buffer.from(base64, 'base64');
} }
const clientIp = getClientIp(req); const clientIp = getClientIp(req);
@@ -276,7 +276,7 @@ function httpAuth(req) {
} }
function decodeBase64(str) { function decodeBase64(str) {
return new Buffer(str, 'base64').toString(); return Buffer.from(str, 'base64').toString();
} }
export function allowCrossDomain(req, res, next) { export function allowCrossDomain(req, res, next) {