Skip to content

Instantly share code, notes, and snippets.

@bearzk
Created October 6, 2022 23:49
Show Gist options
  • Save bearzk/9712c746b52bbb0eb0613a220b8a7ae5 to your computer and use it in GitHub Desktop.
Save bearzk/9712c746b52bbb0eb0613a220b8a7ae5 to your computer and use it in GitHub Desktop.
peek into stream
const { pipeline: pipelineAsCallback, Transform, Readable } = require('stream');
const { promisify } = require('util');
const pipeline = promisify(pipelineAsCallback);
const debugStream = new Transform({
objectMode: true,
transform(chunk, encoding, callback) {
console.log('chunk');
console.log(JSON.stringify(chunk, null, 2));
this.push(chunk); // forward / passthrough
callback();
}
});
await pipeline([
teamsUsersMappingStream,
debugStream,
teamTransformStream,
teamWriteStream,
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment