Skip to content

Commit b54d23f

Browse files
committed
remove depricated use of Buffer
1 parent c070876 commit b54d23f

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/auth.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ function getSocketSignature(pusher, token, channel, socketID, data) {
1818
"Cannot generate shared_secret because encryptionMasterKey is not set"
1919
)
2020
}
21-
result.shared_secret = Buffer(pusher.channelSharedSecret(channel)).toString(
22-
"base64"
23-
)
21+
result.shared_secret = Buffer.from(
22+
pusher.channelSharedSecret(channel)
23+
).toString("base64")
2424
}
2525

2626
return result

lib/token.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function Token(key, secret) {
2121
Token.prototype.sign = function (string) {
2222
return crypto
2323
.createHmac("sha256", this.secret)
24-
.update(new Buffer(string, "utf-8"))
24+
.update(Buffer.from(string))
2525
.digest("hex")
2626
}
2727

tests/helpers/http_proxy.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ var net = require("net")
33
var url = require("url")
44

55
function handleInit(client) {
6-
inBuffer = new Buffer("")
6+
inBuffer = Buffer.from("")
77

88
function onData(chunk) {
99
inBuffer = Buffer.concat([inBuffer, chunk])
1010

11-
var lines = splitBufferOnce(inBuffer, new Buffer("\r\n"))
11+
var lines = splitBufferOnce(inBuffer, Buffer.from("\r\n"))
1212
if (lines[1] === null) {
1313
// still reading the first line
1414
return
@@ -50,12 +50,12 @@ function handleInit(client) {
5050

5151
function handleConnectInit(client, hostname, port, inBuffer) {
5252
function advanceIfHeadersWereSent() {
53-
var blocks = splitBufferOnce(inBuffer, new Buffer("\r\n\r\n"))
53+
var blocks = splitBufferOnce(inBuffer, Buffer.from("\r\n\r\n"))
5454
if (blocks[1] !== null) {
5555
// discard the headers
5656
unbind()
5757
handleConnecting(client, hostname, port, blocks[1], function () {
58-
client.write(new Buffer("HTTP/1.0 200 Connection established\r\n\r\n"))
58+
client.write(Buffer.from("HTTP/1.0 200 Connection established\r\n\r\n"))
5959
})
6060
}
6161
}

0 commit comments

Comments
 (0)