https://github.com/heapwolf/netpeek
this is stupid, dont use it, its just an experiment.
https://github.com/heapwolf/netpeek
Last synced: about 1 month ago
JSON representation
this is stupid, dont use it, its just an experiment.
- Host: GitHub
- URL: https://github.com/heapwolf/netpeek
- Owner: heapwolf
- Created: 2013-03-26T18:40:58.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-03-26T19:45:00.000Z (about 12 years ago)
- Last Synced: 2025-03-29T19:11:08.960Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 129 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NAME
netpeek(3)# SYNOPSIS
Find out how many bytes get sent over the network without using `c++`.# USAGE
Netpeek can also take an option `{ aggregate: true }` if you want to add all the
bytes together instead of emitting them each time data is collected. Once Netpeek
is required, it will start collecting data from anywhere in your application.```js
var netpeek = require('../../netpeek')();
var assert = require('assert');require('./test/tests/http-request-aggregate');
netpeek.on('data', function(data) {
console.log(data);
});
```# EXAMPLES
Output data is json.
```json
{
"httpParseCount": 2,
"bytesRead": 3423,
"bytesDispatched": 496
}
```The following code (test/tests/http-request-aggregate.js) produced the output above.
```js
var http = require('http');var options = {
hostname: 'www.google.com',
port: 80,
path: '/upload',
method: 'POST'
};var req = http.request(options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {});
});req.on('error', function(e) {});
req.write('data\n');
req.write('data\n');
req.end();
```