Fixed Buffer deprecated warnings when using node >= v10

This commit is contained in:
Nicolas Dextraze
2019-11-01 12:53:24 -07:00
parent 78677ba53e
commit 67dab18d53
8 changed files with 43 additions and 29 deletions

View File

@ -33,8 +33,8 @@ Object.freeze(streamPosition);
function createJsonEventData(eventId, event, metadata, type) {
if (!event || typeof event !== 'object') throw new TypeError("data must be an object.");
var eventBuf = new Buffer(JSON.stringify(event));
var metaBuf = metadata ? new Buffer(JSON.stringify(metadata)) : null;
var eventBuf = Buffer.from(JSON.stringify(event));
var metaBuf = metadata ? Buffer.from(JSON.stringify(metadata)) : null;
return new EventData(eventId, type || event.constructor.name, true, eventBuf, metaBuf);
}