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
const CDP = require('chrome-remote-interface'); | |
const minimist = require('minimist'); | |
const args = minimist(process.argv.slice(2), { | |
alias: {port: 'p'}, | |
default: {port: 9222}, | |
}); | |
async function main() { | |
const client = await CDP({port: args.port}); |
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
0 info it worked if it ends with ok | |
1 verbose cli [ '/Users/jinwoo/.nvm/versions/node/v10.1.0/bin/node', | |
1 verbose cli '/Users/jinwoo/.nvm/versions/node/v10.1.0/bin/npm', | |
1 verbose cli 'up', | |
1 verbose cli 'cosmiconfig' ] | |
2 info using [email protected] | |
3 info using [email protected] | |
4 verbose npm-session 5a012709bdb9e331 | |
5 verbose update computing outdated modules to update | |
6 silly mapToRegistry name cosmiconfig |
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
$ npm start | |
> [email protected] start /Users/jinwoo/src/trace-events | |
> node index.js | |
supported categories: | |
node | |
node.async | |
node.bootstrap | |
node.perf |
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
const fastify = require('fastify'); | |
const fastifyAutoPush = require('fastify-auto-push'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const {promisify} = require('util'); | |
const fsReadFile = promisify(fs.readFile); | |
const STATIC_DIR = path.join(__dirname, 'static'); | |
const CERTS_DIR = path.join(__dirname, 'certs'); |
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
for (const asset of ['/static/awesome.css', '/static/unicorn.png']) { | |
// stream is a ServerHttp2Stream. | |
stream.pushStream({':path': asset}, (err, pushStream) => { | |
if (err) throw err; | |
pushStream.respondWithFile(asset); | |
}); | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Awesome Unicorn!</title> | |
<link rel="stylesheet" type="text/css" href="/static/awesome.css"> | |
</head> | |
<body> | |
This is an awesome Unicorn! <img src="/static/unicorn.png"> | |
</body> | |
</html> |