remove use of deprecated 'new Buffer' instanciation
This commit is contained in:
parent
32bdfacd92
commit
4aaef2d811
@ -284,7 +284,7 @@ module.exports.create = function (cfg) {
|
|||||||
|
|
||||||
const storeMessage = function (ctx, channel, msg, isCp, optionalMessageHash) {
|
const storeMessage = function (ctx, channel, msg, isCp, optionalMessageHash) {
|
||||||
const id = channel.id;
|
const id = channel.id;
|
||||||
const msgBin = new Buffer(msg + '\n', 'utf8');
|
const msgBin = Buffer.from(msg + '\n', 'utf8');
|
||||||
|
|
||||||
queueStorage(id, function (next) {
|
queueStorage(id, function (next) {
|
||||||
// Store the message first, and update the index only once it's stored.
|
// Store the message first, and update the index only once it's stored.
|
||||||
|
|||||||
2
rpc.js
2
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
|
// 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(validatedBlock) === 'undefined') { throw new Error('should never happen'); } */
|
||||||
/*:: if (typeof(path) === '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); }
|
if (err) { return void cb(err); }
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -832,7 +832,7 @@ const messageBin = (env, chanName, msgBin, cb) => {
|
|||||||
|
|
||||||
// append a string to a channel's log as a new line
|
// append a string to a channel's log as a new line
|
||||||
var message = function (env, chanName, msg, cb) {
|
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
|
// stream messages from a channel log
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
// polyfill for atob in case you're using this from node...
|
// 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.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) {
|
Util.slice = function (A, start, end) {
|
||||||
return Array.prototype.slice.call(A, start, end);
|
return Array.prototype.slice.call(A, start, end);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user