A stream is an abstract interface for working with streaming data in Node.js. The stream module provides a base API that makes it easy to build objects that implement the stream interface.
Questions tagged [nodejs-stream]
306 questions
                    
                    39
                    
            votes
                
                4 answers
            
        The "chunk" argument must be of type string or an instance of Buffer
I'm running the following code and it fails with the below error.
AWS Code to list all objects inside a bucket.
const http = require('http');
const host = '127.0.0.1';
const port = 5000;
const path = require('path');
const url =…
         
    
    
        anish anil
        
- 2,299
- 7
- 21
- 41
                    24
                    
            votes
                
                2 answers
            
        how to create a readable stream from a remote url in nodejs?
on nodejs documentation, the streams section says I can do fs.createReadStream(url || path).
But, when I actually do that It tells me Error: ENOENT: no such file or directory.
I just want to pipe the video from a readable to a writable stream, But…
         
    
    
        Martin Wittick
        
- 433
- 1
- 4
- 14
                    24
                    
            votes
                
                4 answers
            
        _read() is not implemented on Readable stream
This question is how to really implement the read method of a readable stream. 
I have this implementation of a Readable stream:
import {Readable} from "stream";
this.readableStream = new Readable();
I am getting this error
events.js:136
       …
         
    
    
        Alexander Mills
        
- 90,741
- 139
- 482
- 817
                    18
                    
            votes
                
                4 answers
            
        Node.js HTTP - TypeError: The header content contains invalid characters
const http = require('http');
const req = http.request({
  method: 'POST',
  hostname: 'cloudsso‐test.myco.com',
  port: 80,
  path: '/as/token.oauth2',
  headers: {
    'Content-Type': 'application/json',
  },
  agent: false  // create a new agent…
         
    
    
        Alexander Mills
        
- 90,741
- 139
- 482
- 817
                    13
                    
            votes
                
                1 answer
            
        Socket.io-Stream not sending to Client
I'm am trying to send (relay) a continuous stream of utf-8 data from server to client. While I can eyeball the data arriving on the server, I cannot pipe it into the Socket and forward it to the Client.
Nodejs Server,
var io =…
         
    
    
        Colin
        
- 930
- 3
- 19
- 42
                    10
                    
            votes
                
                1 answer
            
        find method is deprecated according to mongodb typings
I currently have this call:
 const q = coll.find(query, {
    tailable: true,
    awaitData: true,
    oplogReplay: true,
    noCursorTimeout: true,
    numberOfRetries: Number.MAX_VALUE
  });
 return q.stream()
but my IDE warns me that this…
        user7898461
                    8
                    
            votes
                
                3 answers
            
        AWS ALB returns 502 Bad Gateway from lambda
I have a lambda function which return base64 string, when I invoke lambda from code it works, but when I call lambda behind ALB and base64 string is large size, ALB gives me error 502 Bad Gateway.
Note:for small size string ALB also works.
// Lambda…
         
    
    
        Dharam
        
- 469
- 2
- 9
- 23
                    8
                    
            votes
                
                1 answer
            
        Unit test a private method that uses request, pipe and stream using mocks
I want to unit test the exported method in the code below. I want to mock the values in the private method to control the reject/resolves of the returned Promise. client is node-postgres  object that is already connected to the database.
I know I…
         
    
    
        Brian
        
- 4,931
- 3
- 32
- 55
                    7
                    
            votes
                
                2 answers
            
        How to write xls file and stream to response in node js
What I have tried is below:
exports.downloadListOfUsers = (req, res) => {
    let users = [{id:'',name:'',lastName:'',gender:''},{...},{...}]
    const XLSX = require('xlsx');
    let ws = XLSX.utils.aoa_to_sheet(users);…
        user11522618
                    7
                    
            votes
                
                3 answers
            
        nodejs async await inside createReadStream
I am reading a CSV file line by line and inserting/updating in MongoDB. The expected output will be 
1. console.log(row);
2. console.log(cursor);
3.console.log("stream");
But getting output like
1. console.log(row);
 console.log(row);…
         
    
    
        Pritam Parua
        
- 672
- 2
- 8
- 27
                    7
                    
            votes
                
                2 answers
            
        Check if res is sent / ended with Express
Using Express, how can I determine the response has been sent / that the response has been completely written to?
app.use((req,res,next) => {
   if(res.ended){
     //
   }
   if(res.finished){
     //
   }
});
how can I tell if res.end() has…
        user11810894
                    7
                    
            votes
                
                5 answers
            
        How to install Node Version Manager(NVM) without admin rights
I have no admin rights in my windows machine. Can I install NVM without admin rights? I tried using the environment variable path setup, but its not working in my case.
         
    
    
        Sandra Pavan
        
- 194
- 1
- 2
- 8
                    6
                    
            votes
                
                0 answers
            
        Node.js - Pipe a file stream from one server to another
I'm trying to use Node.js to get a file from a remote URL then send it to another server (using an API provided by each of the two websites). I already managed to successfully upload a local file to the remote server using…
         
    
    
        MirceaKitsune
        
- 777
- 1
- 5
- 14
                    5
                    
            votes
                
                2 answers
            
        Issue with socket.io-stream importation in Angular 6
I'm using npm install socket.io-stream
 I implemented socket.io-stream on my angular component like this : 
import * as io from 'socket.io-client';
import * as ss from 'socket.io-stream';
I just want to create a duplex stream like this…
         
    
    
        geoffroy lheureux
        
- 51
- 3
                    5
                    
            votes
                
                0 answers
            
        Node.js multiple process to writestream on same file
Is it okay to multiple process to write data to same file using writestream? what about the performance impact and data loss??
var fs = require('fs');
var cluster = require('cluster');
if(cluster.isMaster){
for(var i=0;i<10; i++)
{
    var child =…
         
    
    
        stupidloser
        
- 61
- 2