简体   繁体   中英

How do I slice a file to pieces and restore it in Javascript FileApi

I'm trying to create ajax file upload but I have encountered an error with it, when you upload a file that is larger than for example:800MB google chrome crash.

So I thought to cut it into pieces and then restore it,but how do I do this?

You need to use javascript FileReader API that helps to create chunks and send it to the server. The mechanism is simple but if you are using small chunk size chrome might crash again if you are uploading asynchronously because of the looping through all the chucks.

Which you can solve the by using Webworkers, Javascript Webworkers acts as separate threads and finally use Websockets if possible.

Few Resources to implement all the

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM