osn

osniffer

http sniffer

Showing:

Popularity

Downloads/wk

2

GitHub Stars

0

Maintenance

Last Commit

6mos ago

Contributors

0

Package

Dependencies

0

Size (min+gzip)

0.8KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

osniffer

HTTP通信を覗き見るためのプロキシを作るライブラリです.

Install

npm install osniffer

Requirements

Node.js >= 7.6.0

Example

content-typeがapplication/jsonの通信をconsoleに出力する例

const zlib = require("zlib");

const es = require("event-stream");

const Sniffer = require("osniffer");
const sniffer = new Sniffer();

sniffer.use(async (ctx, next) => {
    if (ctx.response.headers["content-type"] === "application/json") {
        await next();
    }
});
sniffer.use(async (ctx, next) => {
    ctx.response
        .pipe(zlib.createGunzip())
        .pipe(es.wait())
        .pipe(es.parse())
        .pipe(es.map(x => console.log(x)));
    await next();
});
sniffer.listen(8080);

Author

Nao Yonashiro (@orisano)

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100