Questions tagged [node-fetch]
462 questions
3
votes
0 answers
node-fetch automatic gzip decompression
My question is if i make a request using the node-fetch library with header Accept-Encoding:'gzip', does node-fetch handle automatic decompression of the response data?

Muhammad Ali Nazar
- 817
- 9
- 18
3
votes
3 answers
Error handling in Async Await API calling
I have a script that uses node-fetch and is asynchronous when making fetch calls. I've tried to implement error handling, yet I have had no luck finding a solution. A snippet of my code is available below, and I need to find a way to detect when the…

DIllon marks
- 59
- 1
- 6
3
votes
1 answer
Streaming response body to file in typescript: Property 'pipe' does not exist on type 'ReadableStream'
I am able to fetch a binary body from an API to write it to a file in node.
const fileStream = fs.createWriteStream(filePath);
fetch(apiURL).then((downloadResponse) => {
downloadResponse.body.pipe(fileStream);
});
However, when doing so I get…

shuri
- 91
- 3
- 12
3
votes
1 answer
How to save data in variable from HTTP request using Node Fetch?
Im trying to save data from GET request into variable using node-fetch, but i got the some result!
When i console log the response, i can see it. But when i assign the resData into variable, i get undefined.
const fetch =…

alifnaiech
- 77
- 9
3
votes
1 answer
how to properly replace axios api with fetch api and map over the received data in nodeJS?
this is the link of the entire file - asyncActions.js
the part with axios api -
const fetchUsers = () => {
return function (dispatch) {
dispatch(fetchUsersRrequest());
axios
.get("https://jsonplaceholder.typicode.com/users")
…

Arka
- 957
- 1
- 8
- 18
3
votes
0 answers
Nodejs ssl3_get_record wrong version number
For the past few months I've been working on a project involving Nodejs (12.16.1).
I've created a backend API (database and other resources) and an authentication service. Im currently updating a Discord bot that uses nodejs (all using the same node…

Aus_Karlos
- 31
- 1
- 3
3
votes
1 answer
Why is .text() and .html() not working with cheerio js and node-fetch?
I am new to Node JS, using node-fetch and cheerio packages. I am trying to scrape data from different websites, so I am testing by passing many different URLs, and selectors. However, in the following code, no matter what selector, or URL I pass as…

Amruta Jandhyala
- 31
- 1
3
votes
1 answer
Send data with node-fetch in node.js to Pure Data (Pd) result in ETIMEDOUT
I'm building a sound installation that downloads weather information and translates that to sound. Also, I've made a simple html site in p5.js that enables the user to turn off the volume and use a slider to play music. Everything is neatly…

notna242
- 31
- 3
3
votes
0 answers
Pause and Resume downloading a file in Node
This is a stripped version of a file download module.
It's an Electron app with React on the front-end, so all Node related things work.
Besides the below code, i'm using res.body.destroy() to close the download at any point.
Also using node-fetch…

Cristian Muscalu
- 9,007
- 12
- 44
- 76
3
votes
2 answers
Using async-await with node-fetch does not return the response to the calling method
I have a function defined in a module that is supposed to do a fetch and return the response. I am having trouble returning the response from the fetch. The calling function gets the return value as "undefined".
I am new to JavaScript and Node so…

Varun Verma
- 704
- 2
- 10
- 20
3
votes
2 answers
Uploading File via API Using NodeJS 'fetch'
I am using an existing API call to send a file to our cloud provider via Nodejs. I have seen several different methods of doing this online, but figured I would stick to using "fetch" as most of my other API calls have been using this as well. …

Seth0080
- 147
- 3
- 10
3
votes
1 answer
Running a node.js program that makes a fetch call to an express server running on my local machine
How do I run a javascript program in node.js that makes a local fetch call to a server running on my local machine?
I have a local express server that is listening on port 4001:
const express = require('express');
const app = express();
const…

lowysng
- 35
- 1
- 3
3
votes
2 answers
How to retry api calls using node-fetch
I am trying to POST a request to external API using node-fetch in my node js code.
I want to retry the request 3 times if there are any timeouts or network failures while doing the POST request.
Could you let me know how to retry the request using…

vignesh d
- 235
- 3
- 6
- 15
3
votes
2 answers
How to get all set-cookie headers from node-fetch?
In one of the projects I started to work on the original owner uses node-fetch for http request. node-fetch provides res.headers.get('set-cookie') but it only returns one of the set-cookie headers. (Usually you can have multiple set-cookie in a…

Aero Wang
- 8,382
- 14
- 63
- 99
3
votes
1 answer
Address not found when making http request with Firebase functions
I've setup a Firebase function for a Google action with Dialogflow that makes an API call using node-fetch but I'm running into problems when I make the actual request. Even though I can visit the URL in the browser, I'm not able to get it to…

James Ives
- 3,177
- 3
- 30
- 63