Download files from the front end , From the back end is gzip Type of , Is there any way to get this file size ?
Because you need to download the progress bar .
current position:Home>The front-end downloads files, and the back-end sends gzip files. Is there a way to get the file size?
The front-end downloads files, and the back-end sends gzip files. Is there a way to get the file size?
2022-04-29 17:45:25【segmentfault】
Other answers 1:
If the server does not return content-length
You can't make a download progress bar with progress tips , Whether or not gzip resources , Because you can't know in advance how big the resources are .
Refer to the browser when downloading, there is no centent-length Only download speed and current download size are available for resource download , No percentage display .
Not all resources can be returned to you conent-length
Of , For streaming data, there is basically no such header , You have to consider this scenario
Other answers 2:
Refer to this article :《 How to implement a download progress bar / Play progress bar 》
copyright notice
author[segmentfault],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/115/202204251143337118.html
The sidebar is recommended
- 07 Chrome browser captures hover element style
- WebGIS development training (ArcGIS API for JavaScript)
- Solution to the blank page of the project created by create react app after packaging
- 19. Html2canvas implements ArcGIS API for JavaScript 4 X screenshot function
- Introduction to JavaScript API for ArcGIS 13
- Development of ArcGIS API for JavaScript under mainstream front-end framework
- Nginx learning notes
- Less learning notes tutorial
- Vue2 cannot get the value in props in the data of the child component, or it is always the default value (the value of the parent component comes from asynchrony)
- LeetCode 217. Determine whether there are duplicate elements in the array
guess what you like
I'll write a website collection station myself. Do you think it's ok? [HTML + CSS + JS] Tan Zi
Front end browser debugging tips
Application of anti chattering and throttling in JavaScript
How to create JavaScript custom events
Several ways of hiding elements in CSS
node. Js-3 step out the use of a server and express package
CSS matrix function
Fastapi series - synchronous and asynchronous mutual conversion processing practice
How to extend the functionality of Axios without interceptors
Read pseudo classes and pseudo elements
Random recommended
- About node JS server related concepts
- Access control module (2)
- About virtual lists
- Developing figma plug-in using Vue 3 + vite
- Learn more about the garbage collection engine of chrome V8 JavaScript engine
- Vue3 uses vite instead of webpack
- How to upload applet code through node? Just take a look
- Using H5 video tag in Vue to play local video in pop-up window
- What is the difference between classes in Es5 and ES6?
- [Vue] play with the slot
- [Part 4 of front-end deployment] using docker to build cache and multi-stage construction to optimize single page applications
- Vue2 simple use of vant (based on Vue CLI)
- node. JS server
- React uses concurrent mode. When the rendering phase exceeds the time slice, high priority tasks jump the queue. How will the lanes on the fiber of the previous task be solved
- Vuecli2 multi page, how to remove HTML suffix
- Vue router dynamically modifies routing parameters
- How to use webpack or configure quasar after context isolation is turned on by electron?
- Vue3 how do parent components call child component methods
- Es learning notes (I): http request
- 【Java WEB】AJAX
- Java project: nursing home management system (java + springboot + thymeleaf + HTML + JS + MySQL)
- Java project: drug management system (java + springboot + HTML + layui + bootstrap + seals + MySQL)
- Java project: agricultural material management system (java + springboot + easyUI + HTML + Maven + MySQL)
- How do Vue, native JS and jQuery feel about development
- The Ajax backend accepts post data and writes it directly to the database
- Java project: agricultural material management system (java + springboot + easyUI + HTML + Maven + MySQL)
- Brother Lao Yu takes you to play with esp32:14 and personally make a two-way wireless remote control (I)
- How to create JavaScript custom events
- A king's time, I learned nginx
- Vue quick start (with actual small items: Notepad, weather forecast, music player)
- Vue: convert user input to numeric type
- - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repom
- vue. config. Understanding of agent in JS
- After the node is successfully installed, CMD can be executed, but the compiler webstorm runs NPM install and prompts that there is no solution to this command
- How to develop and deploy front-end code in large companies
- Vue assigns permissions to buttons through instructions
- [development diary from 22 years to April] Vue problems encountered in actual projects and their solutions
- [methodology 1] CSS development skills - global style setting and local style
- vue3. 0 dynamically bind and obtain DOM through ref;
- How to use HTML for touch event in mobile terminal