Flowjs file upload - AngularJS and Node

浪尽此生 提交于 2019-12-06 16:27:46

Reassembling all chunks is easy, just call this:

     var stream = fs.createWriteStream(filename);
     r.write(identifier, stream);

And that is it!

But other question is, when this method should be called? Maybe when all chunks are uploaded and present at tmp folder.

But there is another issue with duplicate calls of the done. This can be solved by creating and locking the file, once all chunks exists. Then call

    r.write(identifier, stream);

Then clean all chunks, release the lock and close the file.

Same approuch is done in php server side library: https://github.com/flowjs/flow-php-server/blob/master/src/Flow/File.php#L102

Hope this helps, and I hope someone could collaborate and update node.js sample with these fixes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!