-
🔭 Actively seeking Software Engineer Internships
-
💻 I'm proficient in Web Infrastructure and DevOps
-
🌱 I’m currently learning Cloud Services and Kubernetes
-
📝 I regularly write articles on medium
-
📫 How to reach me [email protected]
A guide about how to upload and process large files (using Vue.js for frontend and Node.js for backend)
License: MIT License
🔭 Actively seeking Software Engineer Internships
💻 I'm proficient in Web Infrastructure and DevOps
🌱 I’m currently learning Cloud Services and Kubernetes
📝 I regularly write articles on medium
📫 How to reach me [email protected]
服务端部分中对切片文件使用sort排序中,用“-”分割,在文件名中带有“-”就会有问题
multiparty解析后的fields和file都是undefined
文件上传成功后,rar文件解压失败,mp4文件播放失效
这个接口一直pending状态,查看代码
const resolvePost = req =>
new Promise(resolve => {
let chunk = "";
req.on("data", data => {
// 这个地方进不来
chunk += data;
});
req.on("end", () => {
console.log('bbbb')
resolve(JSON.parse(chunk));
});
});
worker.terminate()
How big is this file?
当chunk数量小于6条时
你会发现
merge请求是和chunk的上传请求一起发出去的
不是代码设计**那样的 等chunk上传完毕 发一条merge
这会有什么问题呢?
此时的merge请求到了node端 fs.readdir(PATH) 无法读到PATH
为什么是6条呢?
浏览器中 http请求 同一个源一次最多6条 所以小于6条时 merge请求会和chunk上传请求一起发出
关于web worker 那段代码,因为我看lz写的是《另外考虑到如果上传一个超大文件,读取文件内容计算 hash 是非常耗费时间的,并且会引起 UI 的阻塞,导致页面假死状态,所以我们使用 web-worker 在 worker 线程计算 hash》 这个地方我看虽然是webwork在计算hash值,但是一直在等这个值,因为下面要用到这个值。。这个地方不用webworker 是不是一样的呢。反正就算用了,主线程也要等。
这里应该是去读取临时目录
file-upload/server/controller.js
Line 78 in e09a52a
当把SIZE值设定为一个较小值,导致有超过一个切片出现时,就会出现最后生成的文件损坏的情况
createFileChunk函数允许传size参数,而通知服务端合并切片的函数那里所传的size是默认的SIZE,这样如果传给createFileChunk的size参数不是默认的SIZE的话就会导致2个size不一致
计算hash时用的是percentage += 100 / fileChunkList.length会导致计算的进度不是连续的,尤其只有一个切片的时候,直接从0到100%了,建议放在onprogress事件中,可通过(e.loaded + size * count) / fileSize * 100生成连续的进度
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.