Skip to content

Commit

Permalink
fix [DEP0005] DeprecationWarning
Browse files Browse the repository at this point in the history
Buffer() is deprecated due to security and usability issues.
It is suggested to use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.


Also discussed in spdy-http2#5
  • Loading branch information
beenotung committed Dec 19, 2022
1 parent ed1ad41 commit f320b64
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/deceiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Deceiver.prototype.emitBody = function emitBody (buffer) {

Deceiver.prototype._emitEmpty = function _emitEmpty () {
// Emit data to force out handling of UPGRADE
var empty = new Buffer(0)
var empty = Buffer.alloc ? Buffer.alloc(0) : new Buffer(0)
if (this.socket.ondata) { this.socket.ondata(empty, 0, 0) } else {
this.socket.emit('data', empty)
}
Expand Down

0 comments on commit f320b64

Please sign in to comment.