0

How do I get the fetch API to cut off the stream after a few hundred bytes? I only need the meta description from the top of the page, and the rest of the page is upwards of 500k

dw1
  • 1,495
  • 13
  • 15

1 Answers1

1

Check if the website has a feature that allows you to send a flag that tells them to only send the meta description.

If it doesn't, then your machine is going to receive the data no matter what. If you want to save time reading the whole response, you can just read until you have all the meta information, then stop reading and discard the rest. This will just save you some I/O time, not bandwidth.

Aaron
  • 400
  • 3
  • 14