mirror of https://github.com/xwiki-labs/cryptpad
Merge branch 'modern-buffer' into staging
This commit is contained in:
commit
715e9270b7
|
@ -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.
|
||||
|
|
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
|
||||
/*:: 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();
|
||||
});
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue