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
0
votes
1 answer
How to await writable stream end Nodejs
I want to wrap the following code in asyn function and await the content written into the file:
const fs = require("fs");
const { stringify } = require("csv-stringify");
const db = require("./db");
const filename = "saved_from_db.csv";
const…

Hairi
- 3,318
- 2
- 29
- 68
0
votes
1 answer
createReadStream returns before resolving
I'm writing a program to iterate files from provided directory in Linux.
I used my function "myReadFile" which return new promise, and it should resolve only when "end" event CB called.
I used myReadFile for each file in the directory and called in…

nour saleh
- 11
- 4
0
votes
1 answer
createWriteStream do not fire an error event when the file is not fully written due to disk space
Here's the problem i'm facing with createWriteStream:
Let's say I have a 100mb file, and i want to write it in another file on the disk
the disk available size is 50mb
my code:
const fs = require('fs');
const w =…

Hakim Bencella
- 187
- 4
- 12
0
votes
0 answers
How to save uint8array media files on nodejs server received from frontend web streams?
I have used the web streams on the frontend side to send big files into multiple chunks , but when it comes to the backend nodejs side i am not able to consume the received unit8array properly . all i got is unsupported file format while saving it…

DevRohan
- 31
- 4
0
votes
1 answer
How to get the CSS selector of a specific element in a website for my bot on NodeJS?
I am trying to get an element so that the discord bot picks it up and sends it on the discord channel. It currently picks nothing. I am not getting any error though.
else if (tokens[0] === '!gtatime'){
const response = await…
0
votes
0 answers
NodeJS, MongoDB - How to concat 2 streams to one and send the result as one array?
I have been encountering an issue for a long time but I haven't found any solution yet,
despite reading other answers that related to this issue.
I have 2 different mongo dbs and I want to concat 2 streams that came from each one,
and send the…

DanielTal
- 21
- 1
0
votes
0 answers
Consuming ReadStream in multiple places
I have a case where I am getting a large CSV from an external source as a ReadStream
I need to consume the ReadStream in 2 places
Upload to S3
Read the CSV to find the latest date in the CSV and upload to db
My solution is working for small files,…

jani_r
- 637
- 1
- 7
- 18
0
votes
0 answers
Stream rich content from a single DIV to another client with NodeJS and JavaScript
A Web app built in PHP/JavaScript has a main pages with several DIVs.
One of the DIVs contains a chat room app via the NodeJS app.
This is working fine.
What we now want to do is share, or rather stream the content of another DIV on the same page to…

TenG
- 3,843
- 2
- 25
- 42
0
votes
1 answer
wav file from fluent-ffmpeg not working for asterisk if returned as stream nodejs
I am using aws polly for text to speech and generating mp3 out of it, to get the certain wav as asterisk needs wav with specific paramters, I am using fluent-ffmpeg npm package.
I generated the file by providing the destination path, and returned…

Sunil Garg
- 14,608
- 25
- 132
- 189
0
votes
0 answers
res.redirect or res.render in a route does not work when sent from a button but works when writing the url manually
this is the button
element.addEventListener("click", function()
{
fetch("/class");
});
});
this is the route
router.get('/class', (req, res, next) => {
performFunctions() // works
res.render('classes', // < does not…

wanksta11
- 59
- 4
- 9
0
votes
1 answer
I have created one node js file to list out all files in my file system , When I am trying to download file its size is changed in node js
When I try to download a file, its size changes in a node js file that I have developed to list out all of the files in my file system.
This is my sample Code :
const filePath = path.join(directoryPath, fileName);
if…

msrajwat298
- 156
- 1
- 2
- 9
0
votes
0 answers
Error handling when piping http response to a file
I have a node.js app and I am writing response data to a file from http request. So far what I found how to do that is as follows.
import fs from 'node:fs/promises'
import http from 'http'
const fetch = async () => {
const url =…

Yuki
- 3,857
- 5
- 25
- 43
0
votes
0 answers
How to grep into large gzip/zstd compressed files about 3GB in aws lambda (docker container) without decompressing it?
Currently I am getting an arrayBuffer from the api call. I manage to convert them in a temporary file using tmp package of nodeJs by simply calling fs.appendFileSync() and writing it chunk by chunk.
while (chunkCount) {
var…

insane
- 36
- 8
0
votes
0 answers
How to batch process an async read stream?
Im trying to batch process the reading of a file and posting to a database. Currently, I am trying to batch it 20 records at a time, as seen below.
Despite the documentBatch.length check I have put in, it still seems to not be working (the database…

Sheen
- 586
- 10
- 22
0
votes
0 answers
Node - Piping remote http large video file stream is slower than serving remote file url directly
I have a simple node server that I want to use to act as a proxy to stream a large video file from an external server (e.g. google drive, dropbox, etc.) which is set up as so:
var http = require("http");
var request = require("request");
var…

Billy Bishop
- 9
- 2