Skip to content

orisano/osniffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published