NodeJS download slower than chrome Possible to simulate browser

0 votes

It takes almost 10 seconds to download the audio file from here using NodeJS, whereas the same download takes less than a second using the browser. I've tried a variety of request libraries, so it's possible that the source slows down non-browser requests??

Would it be feasible to imitate a browser request or adjust certain settings such that the NodeJS download is as fast as the browser download if this is the case? Thanks!

EDIT: I've tried the following code:

https.get({
  host: q.host,
  path: q.path,
  headers: { 'User-Agent': 'Mozilla/5.0'}
}, (response) => {
  response.pipe(filePath).on('finish', () => {
    console.log('done')
})
May 27 in Node-js by Vaani
• 7,020 points
29 views

1 answer to this question.

0 votes
It appears that the browser is not downloading the complete audio stream at once, but rather downloading it in chunks via byte ranges so that it can start playing almost instantly. Your nodejs code, on the other hand, is attempting to download the complete audio file. It also appears to be using the QUIC protocol (designed for faster downloads).
answered May 30 by Neha
• 8,560 points

Related Questions In Node-js

0 votes
1 answer

How to extract request http headers from a request using NodeJS connect?

Hello @kartik, To see a list of HTTP ...READ MORE

answered Jul 15, 2020 in Node-js by Niroj
• 82,700 points
13,598 views
0 votes
1 answer

How to get the _id of inserted document in Mongo database in NodeJS?

Hello @kartik, A shorter way than using second ...READ MORE

answered Sep 7, 2020 in Node-js by Niroj
• 82,700 points
8,030 views
0 votes
1 answer

How to create an Excel File with Nodejs?

Hello @kartik, Just create a file with Tabs ...READ MORE

answered Sep 7, 2020 in Node-js by Niroj
• 82,700 points
1,060 views
0 votes
1 answer

How to run app.js in nodejs?

Hello @kartik, Assuming I have node and npm properly installed on the ...READ MORE

answered Oct 13, 2020 in Node-js by Niroj
• 82,700 points
1,168 views
0 votes
1 answer

How to get path from the request in nodejs?

Hello @kartik, Try this out: var http = require('http'); var ...READ MORE

answered Oct 14, 2020 in Node-js by Niroj
• 82,700 points
2,222 views
0 votes
1 answer

How to provide a mysql database connection in single file in nodejs?

Hello @kartik, You could create a db wrapper ...READ MORE

answered Oct 15, 2020 in Node-js by Niroj
• 82,700 points
4,030 views
0 votes
1 answer

How to split and modify a string in NodeJS?

Hello @kartik, Use split and map function: var str = "123, 124, 234,252"; var ...READ MORE

answered Oct 16, 2020 in Node-js by Niroj
• 82,700 points
364 views
0 votes
1 answer

How to run shell script file using nodejs?

Hello @kartik, You could use "child process" module ...READ MORE

answered Oct 16, 2020 in Node-js by Niroj
• 82,700 points
4,186 views
0 votes
1 answer

Is there a way to download videos from YouTube Studio using NodeJS

Try this project in the github repository ...READ MORE

answered May 27 in Node-js by Neha
• 8,560 points
37 views
0 votes
1 answer

NodeJS - Upload ~36MB file to VirusTotal failing

The VirusTotal file/scan API request has a ...READ MORE

answered May 27 in Node-js by Neha
• 8,560 points
24 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP