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.
nodejs-stream
302
questions
0
votes
1
answer
23
views
How to dynamically split Readable stream into multiple streams depending on the count limit
I have Readable stream which provides objects to another Transform stream (which is CsvFormatterStream<I, O> from @fast-csv/format npm package). Then the csv stream is piped to fs Writeable ...
0
votes
2
answers
70
views
Array not resetting in JavaScript while reading from stream
I am trying to insert data coming from a remote CSV file in MongoDB (using Mongoose).
I would like to do so in bulk inserts of 100 items at a time.
Here's my code:
import csv from 'csv-parser'
import ...
0
votes
0
answers
45
views
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-prefix.js'
i recently installed nodejs on my laptop running on win 11 . node -v ran perfectly . but tried running the script npm --version its showing this error
PS C:\Users\saikat mandal> node
Welcome to ...
0
votes
0
answers
195
views
When the Nestjs program uses StreamableFile to return the stream, the picture cannot be displayed normally
I tried to return the image file stream through StreamableFile according to the example on the official website, but the image could not be displayed normally. The file exists and the path is correct.
...
1
vote
1
answer
557
views
Nest js / node js file upload with multer: Pass a file stream to function handler
Multer gets a file from the request in a readable stream, and with default engines, we can save the file on disk or in RAM. After that, it's accessible in a file object that goes to the route handler. ...
0
votes
0
answers
40
views
How can I reverse a stream to read a JSONL backward?
I have a JSONL online file I need to parse line by line in the following format:
{ "id": "something1" }
{ "id": "foo1", "__parentId": "something1&...
-1
votes
2
answers
29
views
app.delete is not working on node.js how to fix
const express = require('express');
const app = express();
app.use(express.json());
app.delete('/', (req, res) => {
res.send('Deleted successfully');
console.log('this is delete');
});
...
0
votes
1
answer
76
views
How get real raw data over tcp
I want to retrieve data via TCP, but the data obtained becomes the presence of new lines.
However, if you use other tools such as putty, the results look good.
Where do you think the problem lies.
...
0
votes
0
answers
177
views
Nodejs sharp-> get metadata and resize image
I'm currently working with Sharp version 0.32.4 to obtain image sizes and subsequently resize them to 50% of their original dimensions using the resize function.
Here's a snippet of my code:
const ...
1
vote
1
answer
80
views
Incorrect NodeJS Crypto Hash when using ReadableStream.pipe
I tried calculate the sha256 hash in 2 different ways, only one of which gave the correct result.
import { createHash } from 'node:crypto';
import { Readable } from 'node:stream';
function f1(info: ...
0
votes
1
answer
220
views
Nodejs readable-stream vs array.map
In studying streams, the following example was provided:
const data = ['some', 'data', 'to', 'read']
const { Readable } = require('stream')
const readable = Readable.from(data)
readable.on('...
1
vote
2
answers
55
views
Building CLI tool in nodejs, child process output is not seen
I am Building a command line tool in node, and as part of this tool I need to execute commands that I have in my system.
The problem is that I don't get the piped output from the child process that I ...
1
vote
0
answers
283
views
NodeJS HTML to PDF then add password
Is there a way to add password on PDF using nodejs? here is the catch:
Convert HTML to PDF (buffer/stream result)
Then tru that buffer/stream result, add/protect pdf with password
I want buffer ...
0
votes
1
answer
216
views
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 = ...
0
votes
1
answer
42
views
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 ...