Questions tagged [nodejs-stream]

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.

306 questions
4
votes
1 answer

Scope of Response of API after function call in node.js

Post API format { "first_name": "sakshi", "last_name":"agrawal", "username":"sakshiagrawallllllll", "is_active":"1" } Response from POST API If the user is already registered, then this will be the format of response. { "code":…
4
votes
2 answers

difference between Callback function and Promise and Async awit

I Understand Callback Function but I cant understand promise method and async and await.why to use this three function in node js.can give explain for example code.
smith hari
  • 437
  • 1
  • 11
  • 22
4
votes
1 answer

Transform JS objects to JSON using transform stream

Note there are many transform streams that do this: JSON -> JS but I am looking to create a Node.js transform stream that can do: JS -> JSON I have a readable stream: const readable = getReadableStream({objectMode:true}); the readable stream…
user5047085
4
votes
0 answers

Client-side nodeJS pass-through stream for audio streaming

We work on a streaming utility, able of streaming a music of Youtube for example. We did a first shot using NodeJS and YTDL. It went perfectly ok, except the fact that the stream would go from Youtube to our server and then to client, and we would…
Robin
  • 129
  • 9
3
votes
1 answer

How to create a post-streaming SSE API with NestJS and Fastify, like OpenAI's API?

I'm trying to implement a Server-Sent Events (SSE) streaming API using NestJS and Fastify, similar to the OpenAI's Create chat completion API. And I want my clients to receive the streamed data using axios with responseType: "stream" just like the…
hash070
  • 641
  • 1
  • 3
  • 8
3
votes
1 answer

How to get the size of data in a Node JS Stream

So I am using this npm library that returns SoundCloud music as a Stream. But after a while searching for an answer, I couldn't get an answer. I searched and discovered that it is impossible to get the full size of the data in a stream. But, is…
Noah
  • 567
  • 5
  • 21
3
votes
1 answer

Send live stream packets to youtube with nodejs?

So I'm trying to create an application that will be able to send packets to Youtube as a live stream. So basically I enter my url to the program (rtmp://a.rtmp.youtube.com/live2) and then it would start streaming and sending packets of an image of…
3
votes
0 answers

How do I wait for the read stream to end and close to trigger another read stream?

I am working in Node.JS, and we are opening a read stream from a CSV, loading that data into chunks, processing each line of those chunks by regex and comparing to another data file, then passing it into a write stream to write to a new file The…
3
votes
2 answers

Can asynchronous transform streams not work in parallel?

I am reading data from a stream in NodeJS and then processing that data using an async function in a transform stream. I would like this transform stream to initiate several calls to the async function in parallel but it seems to do it one at a…
Ludwig Magnusson
  • 13,964
  • 10
  • 38
  • 53
3
votes
1 answer

How to write unit test for postgresql database on nodejs

I am trying to write test for my API with postgresql. It seem the test is not hitting the right database for response or maybe my configuration is not proper for the test. I expect the test to check my token and treat as req from a body but the test…
Darotudeen
  • 1,914
  • 4
  • 21
  • 36
3
votes
1 answer

Node 'readline' how todetect that current line is last line in a file

I am reading a file line by line with nodejs 'readline'. I am reading a .csv file line by line and converting it to JSON. I start with writing '{' then each line is parsed, formatted, and terminated with ','. I want to do something different with…
MikeB
  • 788
  • 1
  • 9
  • 27
3
votes
1 answer

Not able to fetch, write and read a font file using nodejs

Problem : File downloaded using the request module, and written it to the file system is differnt to the one directly downloaded using the browser I am fetching a font file located at…
Tripti Rawat
  • 645
  • 7
  • 19
3
votes
1 answer

nodejs - request - express- use file readStream inside of a post handler

I'm using nodejs and express4. I have a form - post method (file upload as base64) and I'm saving this file to a gridfs with streams. this is my code: exports.transcribe = function (gridfs, req, res) { const buffer =…
jaecktec
  • 440
  • 4
  • 15
3
votes
1 answer

Strategy in Nodejs for combining multiple readable streams

I am trying to solve a Nodejs stream challenge. I have read the node documentation on streams multiple times, and implemented different attempts to solve the challenge. Trying with both duplex, transform, readable and writable :) I have multiple…
DauleDK
  • 3,313
  • 11
  • 55
  • 98
3
votes
2 answers

Reading buffer data from uploaded file in NodeJS

I am uploading a file using 'express' module. I have to read the EXIF data of the uploaded image using node-exif. I do not want to store the file on disk and the above module support reading EXIF data from buffer. I need to read the buffer data from…
User2682
  • 193
  • 2
  • 4
  • 13
1
2
3
20 21