this approach is good for small data, but with larger files with many 
concurrent users this may eat up your memory, because the Stream buffers 
the data there. In this case you can just create a Buffer and write it when 
done. But i also prefer the tmp-file approach: no buffering and a mv is on 
the disk is not that expensive.

Am Donnerstag, 7. März 2013 16:15:04 UTC+1 schrieb Luke Arduini:
>
> @tim you're thinking of streams as just file-related things
>
> thorsten - 
>
> Using the new stream class you can do:
>
> var stream = new Stream.Readable()
> stream.push(null)
> stream.push('your data and stuff')
>
> when you're ready for a file
>
> stream.pipe(fs.createWriteStream('outputfile'))
>
> keep in mind data events wont get emitted without a listener in new 
> streams, for better/worse depending on what you're trying to do
>
>
> On Thu, Mar 7, 2013 at 9:43 AM, Tim Dickinson <[email protected]<javascript:>
> > wrote:
>
>> I dont really understand what your trying to do. You cant create a write 
>> stream without a file name. You could create a random file name and then 
>> rename it once you have the real file name.
>>
>>
>> On Thursday, March 7, 2013 9:35:00 AM UTC-5, Thorsten Moeller wrote:
>>>
>>> Hi,
>>>
>>> i am creating a writestream on a server connection event using a path 
>>> join of a fix path and a variable for the filename. As the filename is not 
>>> known on server connection event (sent later via connection data event) , 
>>> it is empty and therefore not working afterwards, producing errors (connot 
>>> open file).
>>>
>>> Is there a way to handle this more dynamically?? Perhaps creating the 
>>> stream first like an global object and later set the filename and then 
>>> using the stream via something like a method???
>>>
>>>
>>> Regards
>>>
>>> Thorsten
>>>
>>  -- 
>> -- 
>> 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]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

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