Created
          October 6, 2022 23:49 
        
      - 
      
- 
        Save bearzk/9712c746b52bbb0eb0613a220b8a7ae5 to your computer and use it in GitHub Desktop. 
    peek into stream
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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