0

I'm sending a fairly large file via express in a little node app of mine. As the file is so large, I send the file in a stream.

On the receiving node app that is downloading the file, I would really like the ability to track the progress of the download.

This SO question uses the 'content-length' header to determine how big a file is. However after a little more research, it seems that when streaming a file the content-length cannot be known ahead of time.

Is there something obvious I'm missing here? I'm a bit surprised that there is no way to know how big a file being streamed is before it's finished downloading...

Isaac
  • 117
  • 1
  • 9
  • What exactly do you mean by “send the file in a stream”? Is it some Node.js feature? HTTP itself doesn’t have a concept of “streaming” — it’s always “streaming” through TCP — it just has two different ways of signaling where a message ends: `Content-Length` (when you know the length in advance) or `Transfer-Encoding: chunked` (when you don’t). – Vasiliy Faronov Mar 22 '19 at 14:13

1 Answers1

0

if you upload via multipart/form-data you can find the content-length included.

jcuypers
  • 1,774
  • 2
  • 14
  • 23