mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
25 lines
607 B
JavaScript
25 lines
607 B
JavaScript
const { inspect } = require('util');
|
|
const http = require('http');
|
|
const Dicer = require('dicer');
|
|
const sink = require('sink');
|
|
|
|
const PORT = 8080;
|
|
|
|
http.createServer((req, res) => {
|
|
let m;
|
|
const dicer = new Dicer({ boundary: m[1] || m[2] });
|
|
|
|
dicer.on('part', (part) => {
|
|
part.pipe(sink())
|
|
part.on('header', (header) => {
|
|
for (h in header) {
|
|
sink(header[h])
|
|
}
|
|
});
|
|
part.on('data', (data) => {
|
|
sink(data)
|
|
});
|
|
});
|
|
}).listen(PORT, () => {
|
|
console.log(`Listening for requests on port ${PORT}`);
|
|
}); |