Hi mscdex,

Thanks for your reply. Emm, as i want to implement one resumable file upload 
system. 

I assumed that the server can receive chunk file multi threads, and only do 
combined task when 

all the chunk files uploaded. I'm using database to track the chunk status. If 
I need to upload

a file with 1G size, i cannot do resumable task with simply using write stream. 
Or maybe i can 

using 'Range' to track the status and send data with range.
 


On Sunday, June 23, 2013 3:29:52 AM UTC+8, mscdex wrote:
>
> On Saturday, June 22, 2013 9:35:17 AM UTC-4, yu sun wrote:
>
>> I'm working on file uploading and want to chunk upload files to the 
>> server, but when i combined the chunked files, the file hash changed(diff 
>> from the orignal hash). There might be some mistakes. Please help. thx thx.
>>
>  
> Why chunk them manually? Just let the streams worry about chunking and 
> just do for the client side:
>
> function putFile(fileStat) {
>   var req = createRequest('/testfiles', 'PUT', { 'Content-Length': 
> fileStat.fileSize });
>   fs.createReadStream(fileStat.filePath).pipe(req);
> }
>
> and for the server side:
>
> exports.put = function(req, res) {
>   // assuming getFilePath() returns a sanitized path ...
>   var ws = fs.createWriteStream(getFilePath());
>
>   ws.on('finish', function() {
>     res.status(200);
>     res.end('uploaded file');
>   });
>   req.pipe(ws);
> };
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to