0

I was looking for a post on downloading large files using urllib and came across a post (Stream large binary files with urllib2 to file) with an answer by @AlexMartelli that showed the following:

chunk = 16 * 1024

I know that 1024 bytes = 1 KiB(KB) by the IEC standard. Does this mean that it will try to download my file in 16 separate 1024 byte "chunks"?

user812786
  • 4,302
  • 5
  • 38
  • 50
  • From what I see it seems that the size of the chunk is what is given in the `CHUNK` variable... So that means that whatever size the file is, it will be read by chunks of 16Kbits. – LoicM May 30 '17 at 16:24
  • That is a misleading statement there, the original code is `chunk = response.read(CHUNK)` as per the [answer](https://stackoverflow.com/a/1517728/206367) supplied suggests the chunk size of 16 times 1024 which equates to reading a chunk of data that is potentially maximum of 16384 K per read operation. – t0mm13b May 30 '17 at 16:24
  • @t0mm13b Isnt that the same as saying it will read it in ~16MB chunks? –  May 30 '17 at 16:41

2 Answers2

0

Yes it means that the person is defining a chunk of 16K units of memory and data will be downloaded in units of 16K memory

PyManiac
  • 474
  • 4
  • 12
0

No, it means that it will try to download the file in one or more 16kiB chunks, since there will only be one number in the end.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358