diff --git a/historyKeeper.js b/historyKeeper.js index 53ce46807..59a694e8c 100644 --- a/historyKeeper.js +++ b/historyKeeper.js @@ -284,7 +284,7 @@ module.exports.create = function (cfg) { const storeMessage = function (ctx, channel, msg, isCp, optionalMessageHash) { const id = channel.id; - const msgBin = new Buffer(msg + '\n', 'utf8'); + const msgBin = Buffer.from(msg + '\n', 'utf8'); queueStorage(id, function (next) { // Store the message first, and update the index only once it's stored. diff --git a/rpc.js b/rpc.js index 8968b9a4c..fcd85a390 100644 --- a/rpc.js +++ b/rpc.js @@ -1062,7 +1062,7 @@ var writeLoginBlock = function (Env, msg, cb) { // FIXME BLOCKS // flow is dumb and I need to guard against this which will never happen /*:: if (typeof(validatedBlock) === 'undefined') { throw new Error('should never happen'); } */ /*:: if (typeof(path) === 'undefined') { throw new Error('should never happen'); } */ - Fs.writeFile(path, new Buffer(validatedBlock), { encoding: "binary", }, function (err) { + Fs.writeFile(path, Buffer.from(validatedBlock), { encoding: "binary", }, function (err) { if (err) { return void cb(err); } cb(); }); diff --git a/storage/file.js b/storage/file.js index 402982f6b..bb65cff43 100644 --- a/storage/file.js +++ b/storage/file.js @@ -832,7 +832,7 @@ const messageBin = (env, chanName, msgBin, cb) => { // append a string to a channel's log as a new line var message = function (env, chanName, msg, cb) { - messageBin(env, chanName, new Buffer(msg + '\n', 'utf8'), cb); + messageBin(env, chanName, Buffer.from(msg + '\n', 'utf8'), cb); }; // stream messages from a channel log diff --git a/www/common/common-util.js b/www/common/common-util.js index ba9fa2f03..da83b5960 100644 --- a/www/common/common-util.js +++ b/www/common/common-util.js @@ -3,7 +3,7 @@ // polyfill for atob in case you're using this from node... window.atob = window.atob || function (str) { return Buffer.from(str, 'base64').toString('binary'); }; // jshint ignore:line - window.btoa = window.btoa || function (str) { return new Buffer(str, 'binary').toString('base64'); }; // jshint ignore:line + window.btoa = window.btoa || function (str) { return Buffer.from(str, 'binary').toString('base64'); }; // jshint ignore:line Util.slice = function (A, start, end) { return Array.prototype.slice.call(A, start, end);