I dont know why but actually i have this issue only with chrome. With 
firefox or with "wget http://localhost:8888/test"; it works fine...
So i have a new issue but it's only with chrome

Le lundi 3 février 2014 03:42:20 UTC+1, Rodrive a écrit :
>
> I really dont get it. If i make something very simple the behavior is 
> still the same : if i try to request 2 times to localhost:8888/test, the 
> first time the download will start, the second time the download will only 
> when the first download end.
>
> This is the small code i just run :
>
>> var express = require('express');
>>
>> var app = express();
>>
>>
>>> app.get('/test', function(req, res){
>>
>>     res.download('./public/test.mkv');
>>
>> });
>>
>>
>>> app.listen(8888);
>>
>> console.log('Listening on port 8888');
>>
>>
> Le dimanche 2 février 2014 23:19:34 UTC+1, Rodrive a écrit :
>>
>> I'm totally agree with you but i dont know where the sync function come 
>> from.
>>
>> I try to make this works ;
>>
>>> var express = require('express');
>>>>
>>>> var app = express();
>>>>
>>>> var Throttle = require('throttle');
>>>>
>>>> var path = require('path');
>>>>
>>>> var filesize = require('filesize');
>>>>
>>>> var fs = require('fs');
>>>>
>>>>
>>>>> // create a "Throttle" instance that reads at 100 kb/s
>>>>
>>>> var rate = +process.argv[2] || 100;
>>>>
>>>> var kb = 1024;
>>>>
>>>> var throttle = new Throttle(rate * kb);
>>>>
>>>>
>>>>> app.get('/test', function(request, response){
>>>>
>>>>     var filepath = './public/test.mkv';
>>>>
>>>>     var file = {
>>>>
>>>>         path: filepath,
>>>>
>>>>         name: path.basename(filepath)
>>>>
>>>>     };
>>>>
>>>>
>>>>>     fs.stat(filepath, function(err, stats){
>>>>
>>>>         console.log('reading');
>>>>
>>>>         response.writeHead(200,{
>>>>
>>>>             'Content-Type': 'application/octet-stream',
>>>>
>>>>             'Content-Length': stats.size,
>>>>
>>>>             'Content-Disposition': "attachment;filename="+file.name
>>>>
>>>>         });
>>>>
>>>>
>>>>>         fs.createReadStream(filepath).pipe(throttle).pipe(response);
>>>>
>>>> //        fs.createReadStream(filepath).pipe(response);
>>>>
>>>>     });
>>>>
>>>> //    console.log('file :' + file.name, 'size :' + 
>>>>> filesize(file.size));
>>>>
>>>>
>>>>>     throttle.on('end', function(){
>>>>
>>>>         console.log('Download over');
>>>>
>>>>         response.end();
>>>>
>>>>     });
>>>>
>>>>     request.on('close', function(){
>>>>
>>>>         console.log('Download cancel');
>>>>
>>>>         response.end();
>>>>
>>>>     });
>>>>
>>>> });
>>>>
>>>>
>>>>> app.listen(8888);
>>>>
>>>> console.log('Listening on port 8888');
>>>>
>>>>
>>>> But even with just a basic use of express without the throttle, the 
>>> result is still the same.
>>>
>> Thx for your help 
>>
>> Le dimanche 2 février 2014 22:12:11 UTC+1, ryandesign a écrit :
>>>
>>>
>>> On Feb 2, 2014, at 08:52, Rodrive <[email protected]> wrote: 
>>>
>>> > I am stuck with the download process. 
>>> > For example if i make a link to a file, when i click on the link the 
>>> download start. However i cant download the same file in the same time. 
>>> > If i click again the download will start only when the first download 
>>> will be finish. It seems that the url is "locked". 
>>> > 
>>> > How can I have the standard behavior : download the same file multiple 
>>> times in "parallel”? 
>>>
>>> If the server that’s serving these files is written in node, then please 
>>> show the code you’re using to respond to the request. I’m guessing you’re 
>>> using sync functions when you should be using async functions so as not to 
>>> block the main event loop. 
>>>
>>>
>>>

-- 
-- 
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