how does sharepoint do download progress

I was downloading a folder from Sharepoint. First time interacting with this technology since J.P.Morgan days. The download doesn’t provide a correct file size (which is something that’s always annoying), and would progress to a certain point and then become very slow. As slow as sub KB per sec.

I was initially furious and looking for solutions. Then I noticed a progress bar and UI on the webpage, along side the actual downloading, that’s telling how many files downloaded and how many left.

Well that’s reassuring. Yes the total # of files figure is jumpy, but I least I know it’s progressing. It must have encountered small fragmented files, thus the slow speed.

But wait, how did they do it? It’s a download. It’s an HTTP request, or multipart at most. How can it know the progress in terms of files on sharepoint? I thought about it, well they must have a separate stream for reporting this. That is confirmed in requests I’m seeing on the page:

"{"source":"Meta","scenario":"Zip","payload":{"type":"ZipProgress","filesProcessed":5920,"totalFiles":6227,"progress":0.95,"currentFileName":"Abu Dhabi/00_Spot Exchange Application/期货产品文档reference/Matrix/Matrix/matrix-prd/Matrix-Web/images/修改登录密码/u6431.png","currentFileSize":242,"bytesDownloadedinCurrentFile":242,"isComplete":false,"errorCode":"","recentlyAddedFiles":"Abu Dhabi/00_Spot Exchange Application/期货产品文档reference/Matrix/Matrix/matrix-prd/Matrix-Web/images/修改登录密码/u6416.png,Abu Dhabi/00_Spot Exchange Application/期货产品文档reference/Matrix/Matrix/matrix-prd/Matrix-Web/images/修改登录密码/u6418.png,Abu Dhabi/00_Spot Exchange Application/期货产品文档reference/Matrix/Matrix/matrix-prd/Matrix-Web/images/修改登录密码/u6421.png,Abu Dhabi/00_Spot Exchange Application/期货产品文档reference/Matrix/Matrix/matrix-prd/Matrix-Web/images/修改登录密码/u6423.png,Abu Dhabi/00_Spot Exchange Application/期货产品文档reference/Matrix/Matrix/matrix-prd/Matrix-Web/images/修改登录密码/u6426.png,Abu Dhabi/00_Spot Exchange Application/期货产品文档reference/Matrix/Matrix/matrix-prd/Matrix-Web/images/修改登录密码/u6431.png","guid":"4ea69b10-80f3-47bd-a081-af1b97e64cab"}}"

^ Today I learned. Neat.

Written on March 9, 2019