-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JS: Switch from
new Buffer
to Buffer.from
Summary: Constructing `Buffer` using the constructor [[https://nodesource.com/blog/understanding-the-buffer-deprecation-in-node-js-10/ | has been deprecated in Node 10 due to security considerations]]. This is a simple and straightforward conversion. Reviewed By: mjesun Differential Revision: D13080655 fbshipit-source-id: 100d8f28c3b255422b26e820aaadcc4f32f41e0d
- Loading branch information
1 parent
5939d07
commit d9c2cda
Showing
3 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ server.on('connection', ws => { | |
console.log('Received message:', message); | ||
console.log('Cookie:', ws.upgradeReq.headers.cookie); | ||
if (respondWithBinary) { | ||
message = new Buffer(message); | ||
message = Buffer.from(message); | ||
} | ||
if (message === 'getImage') { | ||
message = fs.readFileSync(path.resolve(__dirname, '[email protected]')); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it should be Buffer.alloc(3)