mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 16:49:58 +00:00
Replace deprecated Buffer constructor usage
This commit is contained in:
@@ -37,7 +37,7 @@ const decode = new Transform({
|
||||
if (!this.hasOwnProperty("buf")
|
||||
&& !this.hasOwnProperty("message_length")) {
|
||||
|
||||
this.buf = new Buffer(0);
|
||||
this.buf = Buffer.alloc(0);
|
||||
this.message_length = null;
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ const encode = new Transform({
|
||||
writableObjectMode: true
|
||||
|
||||
, transform (chunk, encoding, callback) {
|
||||
const message_length = new Buffer(4);
|
||||
const message = new Buffer(JSON.stringify(chunk));
|
||||
const message_length = Buffer.alloc(4);
|
||||
const message = Buffer.from(JSON.stringify(chunk));
|
||||
|
||||
// Write message length
|
||||
message_length.writeUInt32LE(message.length, 0);
|
||||
|
||||
Reference in New Issue
Block a user