Skip to content

Commit

Permalink
chore: Replaced new Buffer with Buffer.alloc
Browse files Browse the repository at this point in the history
new Buffer is now deprecated, replaced with Buffer.alloc it appears to be even faster with current versions of node.js
  • Loading branch information
bitpredator committed Oct 7, 2024
1 parent 44d8a0e commit ba7cec2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server-data/resources/[phone]/screenshot-basic/dist/server.js
Original file line number Diff line number Diff line change
@@ -24284,7 +24284,7 @@ Accepts.prototype.languages = function(languages_) {
// Node authors rewrote Buffer internals to make it compatible with
// Uint8Array and we cannot patch key functions since then.
// Note: this does use older Buffer API on a purpose
iconv.supportsNodeEncodingsExtension = !(Buffer.from || new Buffer(0) instanceof Uint8Array);
iconv.supportsNodeEncodingsExtension = !(Buffer.from || Buffer.alloc(0) instanceof Uint8Array);

iconv.extendNodeEncodings = function extendNodeEncodings() {
if (original) return;
@@ -25566,12 +25566,12 @@ Accepts.prototype.languages = function(languages_) {
can be divided vy 3.
*/
const offset = parseInt(part.transferBuffer.length / 4, 10) * 4;
part.emit('data', new Buffer(part.transferBuffer.substring(0, offset), 'base64'));
part.emit('data', Buffer.alloc(part.transferBuffer.substring(0, offset), 'base64'));
part.transferBuffer = part.transferBuffer.substring(offset);
};

parser.onPartEnd = function() {
part.emit('data', new Buffer(part.transferBuffer, 'base64'));
part.emit('data', Buffer.alloc(part.transferBuffer, 'base64'));
part.emit('end');
};
break;
@@ -25873,10 +25873,10 @@ Accepts.prototype.languages = function(languages_) {
};

MultipartParser.prototype.initWithBoundary = function(str) {
this.boundary = new Buffer(str.length + 4);
this.boundary = Buffer.alloc(str.length + 4);
this.boundary.write('\r\n--', 0);
this.boundary.write(str, 4);
this.lookbehind = new Buffer(this.boundary.length + 8);
this.lookbehind = Buffer.alloc(this.boundary.length + 8);
this.state = S.START;

this.boundaryChars = {};

0 comments on commit ba7cec2

Please sign in to comment.