I want to measure TTFB (Time to First Byte) for an HTTP request. I’ve hosted a 0KB pdf file on an amazon S3 server, and I’m using the fetch api to get it. Here’s my code: In the chrome developers network tab, I can see the request and all of its timing info: But I can’t access this info in
Tag: fetch-api
How to download a ReadableStream on the browser that has been returned from fetch
I am receiving a ReadableStream from a server, returned from my fetch call. A ReadableStream is returned but I don’t know how to trigger a download from this stage. I can’t use the url in an href because it requires an Authorization token. I don’t want to install fs on the client so what options do I have? Update 1
How to handle streaming data using fetch?
I have used async for with great success in handling output streams from processes with node.js, but I’m struggling to get something that I was hoping could “just work” with the browser fetch API. This works great to async’ly handle chunks of output streaming from a process: (in an async function context here of course) I tried to do something
Fetch API: how to determine if an error is a network error
So I have some code like this: Where transform can throw some of its own errors. I’m try to catch for network errors from the fetch API. My question is how do I implement isNetworkError that works across browsers? Note: that this should only return true if the network is offline. It seems like both chrome and firefox throws a
Javascript Fetch is Slow (60ms vs 3ms)
Running Javascript fetch takes about 60ms per call on my machine. Compared to Python requests at 3ms, this is much slower. Questions Why is fetch so much slower? Is there any way to speed it up? I am OK with answers that require me to reconfigure my browser. Experiment These are the details of my experiment. System Browser: Firefox 74.0
“NetworkError when attempting to fetch resource.” only on Firefox
I’m doing a POST request from my frontend using fetch API. But when I tried in Firefox, it doesn’t work. In Chrome works fine. Here’s what I’m trying to do. Answer So, guys, here’s the solution. The problem was the time for refreshing the form, is refreshing before send it. To solve this, set to refresh the form on response,
wait for one fetch to finish before starting the next
I have a list of data that I am sending to google cloud. My current code looks like this: This works with one team but it is timing out if sending multiple files and the files are bigger. I am sending images over and not strings. To solve this I need to POST the data one file by one, and
React useEffect causing: Can’t perform a React state update on an unmounted component
When fetching data I’m getting: Can’t perform a React state update on an unmounted component. The app still works, but react is suggesting I might be causing a memory leak. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.” Why do I keep
Empty body in fetch POST request
I’m struggling with the fetch API in Javascript. When I try to POST something to my server with fetch method, the request body contains an empty array. But when I use Postman it works. Here is my server-side code in Node.js: Here is my client-side code: The problem is that the req.body is empty on server side. Answer The issue
Show fetch results in render return() in React.js
My question is about how to show array results in render return(). I made a fetch to the API and now I get results that get stored in a array. I need to show this results but I tried with a for{} inside the return and it doesn’t work, and I also tried with .map and the map is undefined.