Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const server = http.createServer((req, res) => {
if (req.method === 'POST') {
// messages TO the target
Asm.connectTo(
pump(req, jsonParser())
).on('done', ({current: object}) => {
this.trackRequest(object);
});
}
if (!ws) {
proxy.web(req, res);
}
});
const server = http.createServer((req, res) => {
if (req.method === 'POST') {
// messages TO the target
Asm.connectTo(
pump(req, jsonParser())
).on('done', ({current: object}) => {
this.trackRequest({ ws: false, data: object});
});
}
if (!ws) {
proxy.web(req, res);
}
});
const server = http.createServer((req, res) => {
if (req.method === 'POST') {
// messages TO the target
Asm.connectTo(
pump(req, jsonParser())
).on('done', ({current: object}) => {
this.trackRequest({ ws: false, data: object});
});
}
if (!ws) {
proxy.web(req, res);
}
});
dataStream,
parser({
packKeys: true,
packStrings: true,
packValues: true,
packNumbers: true,
streamNumbers: false,
streamValues: false,
streamKeys: false,
streamStrings: false
}),
new TransformKeysJsonStream({
getCurrentTransform: buildEntityKeysTransform("camel")
})
];
const asm = Asm.connectTo(streams[streams.length - 1]);
const donePromise = new Promise(resolve => {
asm.on('done', asm => {
resolve(asm.current);
});
});
await StreamUtil.pipelineAsync(streams);
const result = await donePromise;
}
async function rawStreamJson() {
const dataStream = fs.createReadStream("./data/load_data.json");
const parserStream = parser();
const asm = Asm.connectTo(parserStream);
const donePromise = new Promise(resolve => {
asm.on('done', asm => {
resolve();
});
});
await StreamUtil.pipelineAsync([
dataStream,
parserStream,
ignore({ filter: "asasas" })
]);
await donePromise;
}