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
0
votes
1 answer

Stream a video from another server to the client through my nodejs server

I have videos stored on a server (server1) that some clients have no access to, and I have another server (server2) that has access to server1 and the clients have access to. I want those clients to be able to watch those videos through server2 on…
0
votes
1 answer

How to store the readStream files of Node.js into Redis and also how to retrieve the stored readStream files from Redis?

I tried converting the readStream (Image) to string and then storing it in Redis. Then retrieving the string from Redis and converting it back to readStream. But it didn't work out. function getFile(fileKey) { console.log(fileKey); const…
0
votes
1 answer

Can counter value be not in sorted order?

I am trying to understand node.js streams. Since the write method on the writer object method is asynchronous, can counter value be out of order? const writer = fs.createWriteStream(path.resolve("modules", "streams", "hello")); writer.on("finish",…
Rajat Aggarwal
  • 392
  • 3
  • 16
0
votes
1 answer

Why some zip file download become error in Nodejs

I tried to download zip files using node-fetch. File successfully download and I can read the json file inside the zip using adm-zip NPM package. But some times getting error when reeding the downloaded file. The zip file is corrupted during…
Ashwanth Madhav
  • 1,084
  • 1
  • 9
  • 21
0
votes
2 answers

Why while loop is needed for reading a non-flowing mode stream in Node.js?

In the node.js documentation, I came across the following code const readable = getReadableStreamSomehow(); // 'readable' may be triggered multiple times as data is buffered in readable.on('readable', () => { let chunk; console.log('Stream is…
0
votes
1 answer

Require construct Behaviour in NodeJS

I am learning node js and I am at the sterams module. I have below query - What is the difference between these two statements. const {Readable} = require("stream") and const Readable = require("stream") Below Code Snippet works . Means data…
Atul
  • 1,560
  • 5
  • 30
  • 75
0
votes
1 answer

Mock Node.js stream pipeline using Jest

I have a method where I am using Node.js pipeline() that is having a last argument for a callback. doSomething(readStream, destinationwritableStream): void { pipeline(readStream, destinationwritableStream, async () => { // some code here. …
Nishant
  • 155
  • 11
0
votes
1 answer

Koa: Stream the HTML

With Koa, one of my route has a long process, and I would want to stream the body to start sending the css and the javascript so the browser can start processing it before it gets the data ( Google recommendation ) So this is how I'm trying to do it…
GuillaumeC
  • 535
  • 1
  • 8
  • 18
0
votes
1 answer

http request in transform Stream

I am banging my head last couple of hours how to do this, I am getting some json data from api with superagent : superagent.get(url) .set('x-rapidapi-host','v3.football.api-sports.io') …
dobrganch
  • 13
  • 1
  • 5
0
votes
0 answers

Nodejs downloading tar.gz file with HTTP get

im a bit stuck with my project and I'am not finding the right answeres to my questions... So first of all I have this client that is a linux machine and it pokes my server with curl trying to download this tar.gz file. On the nodejs server my…
K-NygyZ
  • 1
  • 2
0
votes
0 answers

nodejs http.get() wont pipe large files or long videos to the reasponse?

Sorry for any inconvenience with the question title, but I don't know how to describe issue. I have the following code to fecth remote video and pipe it to the response (play it in the browser using html5 video tag): const express =…
0
votes
1 answer

Res many videos Nodejs

I'm working on an app who contains a page of videos. The front is in Angular and the back in Node.js I choice to store my videos directly with API in the assets folder. files.forEach(file => { console.log(file); }); }); I can take my…
zwei
  • 3
  • 4
0
votes
1 answer

Get HTTP headers/body from async hook HTTPINCOMINGMESSAGE

I'm trying to get the HTTP headers and the HTTP body from the IncomingMessage instance provided by the async hook HTTPINCOMINGMESSAGE: import asyncHooks = require("async_hooks"); import { IncomingMessage } from "http"; asyncHooks.createHook({ …
brillout
  • 7,804
  • 11
  • 72
  • 84
0
votes
1 answer

How to read file from NAPI (node-addon) interface and write to a different file using nodejs filestream

I am trying to read a file in the NAPI application and call the callback function to write it to the writestream in the nodejs application. exmaple_Class.cpp void readFromTransientFile(const Napi::CallbackInfo &info) { Napi::Env env =…
0
votes
0 answers

Stream-adventure. Node.js. SECRETZ. Code inputs nothing

Why this code inputs nothing? I'm trying to solve the 17th exercise (SECRETZ) const concat = require('concat-stream') const tar = require('tar'); const fs = require('fs') const parser = new tar.Parse() const crypto = require('crypto') let name =…
user11821079