Skip to content

Commit 65537f2

Browse files
davimacedodplewis
authored andcommitted
Remove Buffer() deprecation notice (parse-community#5942)
1 parent ba60b57 commit 65537f2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Adapters/Storage/Mongo/MongoTransform.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@ var BytesCoder = {
15441544
},
15451545

15461546
JSONToDatabase(json) {
1547-
return new mongodb.Binary(new Buffer(json.base64, 'base64'));
1547+
return new mongodb.Binary(Buffer.from(json.base64, 'base64'));
15481548
},
15491549

15501550
isValidJSON(value) {

src/middlewares.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function handleParseHeaders(req, res, next) {
105105
if (fileViaJSON) {
106106
// We need to repopulate req.body with a buffer
107107
var base64 = req.body.base64;
108-
req.body = new Buffer(base64, 'base64');
108+
req.body = Buffer.from(base64, 'base64');
109109
}
110110

111111
const clientIp = getClientIp(req);
@@ -276,7 +276,7 @@ function httpAuth(req) {
276276
}
277277

278278
function decodeBase64(str) {
279-
return new Buffer(str, 'base64').toString();
279+
return Buffer.from(str, 'base64').toString();
280280
}
281281

282282
export function allowCrossDomain(req, res, next) {

0 commit comments

Comments
 (0)