Skip to content
Permalink
Browse files

Chore: replace depracated 'new Buffer' with 'Buffer.from' (#2396)

  • Loading branch information...
yanivefraim authored and aslushnikov committed Apr 17, 2018
1 parent b40e381 commit ed4be10ae317de0ddc16f00c9f22e963028634d7
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/Page.js
  2. +1 −1 lib/Tracing.js
  3. +1 −1 test/server/SimpleServer.js
@@ -749,7 +749,7 @@ class Page extends EventEmitter {
if (options.fullPage)
await this.setViewport(this._viewport);

const buffer = new Buffer(result.data, 'base64');
const buffer = Buffer.from(result.data, 'base64');
if (options.path)
await writeFileAsync(options.path, buffer);
return buffer;
@@ -801,7 +801,7 @@ class Page extends EventEmitter {
marginRight: marginRight,
pageRanges: pageRanges
});
const buffer = new Buffer(result.data, 'base64');
const buffer = Buffer.from(result.data, 'base64');
if (options.path)
await writeFileAsync(options.path, buffer);
return buffer;
@@ -79,7 +79,7 @@ class Tracing {
while (!eof) {
const response = await this._client.send('IO.read', {handle});
eof = response.eof;
bufs.push(new Buffer(response.data));
bufs.push(Buffer.from(response.data));
if (path)
await writeAsync(file, response.data);
}
@@ -185,7 +185,7 @@ class SimpleServer {
const pathName = url.parse(request.url).path;
if (this._auths.has(pathName)) {
const auth = this._auths.get(pathName);
const credentials = new Buffer((request.headers.authorization || '').split(' ')[1] || '', 'base64').toString();
const credentials = Buffer.from((request.headers.authorization || '').split(' ')[1] || '', 'base64').toString();
if (credentials !== `${auth.username}:${auth.password}`) {
response.writeHead(401, { 'WWW-Authenticate': 'Basic realm="Secure Area"' });
response.end('HTTP Error 401 Unauthorized: Access is denied');

0 comments on commit ed4be10

Please sign in to comment.
You can’t perform that action at this time.