mirror of
https://github.com/status-im/react-native.git
synced 2025-02-20 13:18:07 +00:00
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
This commit is contained in:
parent
5939d078a0
commit
d9c2cdae41
@ -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, 'flux@3x.png'));
|
||||
|
@ -43,7 +43,7 @@ function create() {
|
||||
process.stdin.setRawMode(true);
|
||||
}
|
||||
|
||||
var buf = new Buffer(3);
|
||||
var buf = Buffer.from(3);
|
||||
var str = '',
|
||||
character,
|
||||
read;
|
||||
@ -62,7 +62,7 @@ function create() {
|
||||
insert = str.length;
|
||||
process.stdout.write('\u001b[2K\u001b[0G' + ask + str);
|
||||
process.stdout.write('\u001b[' + (insert + ask.length + 1) + 'G');
|
||||
buf = new Buffer(3);
|
||||
buf = Buffer.from(3);
|
||||
}
|
||||
continue; // any other 3 character sequence is ignored
|
||||
}
|
||||
|
@ -23,15 +23,15 @@ function copyToClipBoard(content) {
|
||||
switch (process.platform) {
|
||||
case 'darwin':
|
||||
var child = spawn('pbcopy', []);
|
||||
child.stdin.end(new Buffer(content, 'utf8'));
|
||||
child.stdin.end(Buffer.from(content, 'utf8'));
|
||||
return true;
|
||||
case 'win32':
|
||||
var child = spawn('clip', []);
|
||||
child.stdin.end(new Buffer(content, 'utf8'));
|
||||
child.stdin.end(Buffer.from(content, 'utf8'));
|
||||
return true;
|
||||
case 'linux':
|
||||
var child = spawn(xsel, ['--clipboard', '--input']);
|
||||
child.stdin.end(new Buffer(content, 'utf8'));
|
||||
child.stdin.end(Buffer.from(content, 'utf8'));
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user