Are you Chunking?

Rahul Jaiswal
2 min readAug 11, 2020

I am part of an Android Knowledge sharing group and recently people on that group were discussing handling chunking. I thought of sharing their conversation here as I found the explanation very interesting:

Member 1: Hello Guys, In android if I’ll have to download a very large file. What would be the best opinion?

Member 2: I feel better to use WorkManager

Member 3: Work Manager is a good option

Member 1: File is of around 500 MB. Suppose 400 MB is downloaded and the internet went off then, it’ll be an issue

Member 4: First of all check with API provider if chunking is implemented or not. If chunking is not implemented, you have to download everything in case of DL fail. Use this library: https://github.com/MindorksOpenSource/PRDownloader

Member 1: Does it work in case the internet goes off?

Member 4: It depends if chunking is enabled at the server-side. Chunking is something you can not control from client-side

Member 1: Why so?

Member 4: Sorry … chunking is something you can not control from the receiver end.

So in case of file upload client will have to take care of chunking coz server is the receiver, while in case of downloading chunking needs to be done by the server.

Think it like this:

You bought 50 ltr of oil of some brand which is packed as a single unit. While bringing it home, the package got damaged and oil drained. Now you have to go to the shop again and buy another 50 ltr unit.

Now there is another brand that offers oil in 10 liters of packaging. In this case, you bought 5 units of 10 liters each and while bringing it home, 2 packs got damaged. In this case, you’ll get back to the shop to get only 2 new packs of oil.

So chunking is nothing but the packaging of data and the party who is providing the data can only decide how to package them.

This is how I understand. Let me know if you find anything wrong or missing in it.

Member 2: Good explanation 👍👍👍

Member 3: yeah .. nice explanation🔥

Member 1: I got all the packets ✌️.

Member 4: @Member 1 You understood?

Member 1: Crystal clear.

--

--