Questions tagged [createwritestream]

54 questions
0
votes
1 answer

Nodejs - Need to perform around 100 API Async request

I am new for nodejs and I trying to perform around 100 API request by using axios npm in single request. What will be best code logic to capture all response in better way of performance / error tracking. Need to capture all response in single JSON…
Anand Rajagopal
  • 1,593
  • 6
  • 24
  • 40
0
votes
1 answer

How to stop a writestream from creating a file when receiving 403 error with axios

I'm using axios to download images and save them locally. I took the below answer from https://stackoverflow.com/a/61269447/7468791 which works great for larger images to make sure they have fully downloaded before writing. However some image urls…
0
votes
0 answers

How to use Node.js streams to append to end of file?

I have a node.js app, which opens a stream: outputStream = fs.createWriteStream("output.txt"); I then, asynchronously, add text to the file: outputStream.write( outputTxt, "utf8" ); This code is being run inside a loop, so it happens hundreds of…
Inkbug
  • 1,682
  • 1
  • 10
  • 26
0
votes
0 answers

What is best practice for using fs.createWriteStream over an http.request in nodejs

I am streaming an xml file in, using fs.createWriteStream. For whatever reason, if the chunk coming in happens to break up xml closing tag, I am seeing a bunch of null characters being added to the data at the end of the chunk and it breaks the…
Brian03
  • 23
  • 5
0
votes
0 answers

Prevent writing file in nodejs

I want to download file from nodejs and write it. Currently, im using axios and createWriteStream. It writes fine. But i want to handle write when file is large. When the file is larger than 5mb, i want it return message " file is large" and prevent…
Hung Vu
  • 81
  • 1
  • 3
  • 12
0
votes
1 answer

how to create a file with no extension using createWriteStream?

so my file to create is like this ./example/myfilename with no extension, and nodejs createWriteStream apparently thinks it is a folder and throws Error: EISDIR: illegal operation on a directory. any way to work around this?
Blake
  • 7,367
  • 19
  • 54
  • 80
0
votes
2 answers

WriteStream doesn't write all data

1st I read in a file line by line with my code. (Round about 1650 lines in the file) 2nd I reformate each line of the file into many lines. 3rd I would like to write the output in a new file. Unfortunately it doesn't write all of the more than 16800…
NewbieXXL
  • 155
  • 1
  • 1
  • 11
-1
votes
1 answer

Puppeteer node.js: Access denied when downloading image

I'm trying to download an image using the fs.createWriteStream function. I'm able to download the image but it's damaged/corrupted.I'm getting an error message saying: "Access Denied You don't have permission to access "https:..." on this…
Sgnoofa
  • 21
  • 6
-3
votes
1 answer

node.js writestream file got invalid symbols

I'm reading text from a big file and write some parts into a new text file: var ws = fs.createWriteStream('output.txt', {flags: 'w',encoding: 'utf8'}); for (var i = 0; i < words.length; i++) { ws.write(words[i][0].toString() +…
user3776738
  • 214
  • 2
  • 10
  • 27
1 2 3
4