Questions tagged [createwritestream]
54 questions
0
votes
1 answer
createWriteStream instance shadowing another instance in nodeJS
My aim is to do something like that :
function writer1(data,file){
const w = fs.createWriteStream(file,{flags:'w'})
for(let i = 0; i< data.length; i++){
w.write(data[i])
}
w.end()
}
function writer2(data,file, *some-stuff*){
…

AVALFINN
- 23
- 3
0
votes
1 answer
Stripe writable stream + nestjs [TypeError: Converting circular structure to JSON]
Im integrating stripes invoicing and quotes into my nestjs api. I am trying to download the quote PDF option but I having issues with node createWriteStream.
Stripe API says to implement the code as follows
const {createWriteStream} =…

Jason McFarlane
- 2,048
- 3
- 18
- 30
0
votes
1 answer
why does ending a write stream clears data that was previously written to that file in nodeJS
i was trying to read content of one file and write it to another using nodeJS.everything works if i do not add fileStream.end(). Below is the code i have written:
const fs= require ('fs');
const readLine = require('readline');
//read…

self-learner
- 19
- 6
0
votes
0 answers
Node - Is it possible that a stream closes or stops writing and how to reopen?
I could not find much information in the documentation. Using fs, is it possible that a stream opened with fs.createWriteStream closes unexpectedly or stops writing to file before calling stream.end()?
One scenario that comes to my mind is an error…

DamiToma
- 921
- 3
- 9
- 27
0
votes
0 answers
How get in Javascript the filename using request.pip(createWriteStream()) on close event?
I'm downloading multiple files parallel with Javascript by using request, pipe and createWriteStream:
for(let i = 0; i < urls.length; i++) {
let r = request(urls[i]).pipe(fs.createWriteStream(fn[i]))
r.on('close', (() => {
…

PowerNow
- 363
- 1
- 2
- 15
0
votes
0 answers
pyspark streaming dataframe write to different path depending on column values
In databricks notebook, I am reading json files with readStream, json has structure for example:
id
entityType
eventId
1
person
123
2
employee
234
3
client
687
4
client
687
My code:
cloudfile = {
"cloudFiles.format":…

Yerassyl Aben
- 21
- 3
0
votes
1 answer
nodejs fs createWriteStream not working with file path prefix
I am trying to call an API, loop through an array of images, assign unique names to each image in the array and then write them to a local directory. If I simplify the code I can write them to the root folder .I already created the sub folder…

lharby
- 3,057
- 5
- 24
- 56
0
votes
0 answers
How to write to xml file with hebrew content
I have an XML file with number of Records with Hebrew content and after I read It I want to save some of the Records that satisfied special condition to new XML file, but when I wrote to this new file, the Hebrew content convert to Gibberish like…

Yakir
- 1
- 2
0
votes
0 answers
I'm closing my writestreams but I get Error: EMFILE: too many open files
I'm using NodeJS and the fs module and I'm getting Error: EMFILE: too many open files when using writestreams.
The thing is that I'm actually closing them so what 's going on?

Commandcracker8
- 13
- 5
0
votes
1 answer
How to download a file from a url that forces download with NodeJS
I am trying to download a pdf file from a API to a local file
The way i am doing it is by make an axios call for the pdf.
This is my request:
const axiosInstance = createAxios();
const response = await axiosInstance.get('https://www.getpdf.com',
{
…

Mika
- 31
- 5
0
votes
0 answers
How to be sure there is actually a file in a link before trying to createWriteStream
I want to be sure that there is actually a file to be downloaded before using fs.createWriteStream because as it is now, it downloads a 404 page and saves it as a xls file...
I have written the following code. How can I implement that and in case of…

Breno
- 135
- 8
0
votes
1 answer
GraphicsMagick .toBuffer() creates empty buffer stream
I have a Firebase Cloud Function that converts a buffer (from PDF) to a PNG using GraphcisMagick. When I attempt to write this PNG buffer to Firebase Storage, I get a file stub but no content (empty file). My conversion to PNG is failing...
async…

Colin
- 930
- 3
- 19
- 42
0
votes
1 answer
ReadStream is not reading uploaded file
I tried this lines to Creating ReadSteam with uploaded files and pipe to WriteStream:
var f2 = req.files.f2;
var f2read = fs.createReadStream(f2)
var f2write = fs.createWriteStream("./trailers/" + id + ".mkv")
f2read.pipe(f2write)
but this…

bahoz99
- 121
- 1
- 6
0
votes
1 answer
Javascript/Nodejs Downloading audio file to disk
Looking to download this wav file. Response.pipe(fileStrm) isn't doing it for me.
Ive looked around. Wondering what the standard way of downloading media from a URL to file is these days.
const request =…

Pocket Lawyer
- 17
- 5
0
votes
1 answer
nodejs createWriteStream - Error: ENOENT: no such file or directory
I have this code in my node cli script
const dateTime = new Date();
const logFile = path.resolve(__dirname, `${dateTime.toLocaleDateString('it-IT')}.txt`);
const appLog = fs.createWriteStream(logFile, {flags: 'a+'});
console.log(chalk`{magenta.bold…

newbiedev
- 2,607
- 3
- 17
- 65