This is to say that he is using node 0.9.x
Also as @greelgorke said, a large file will bring up problem with keeping
the data in memory.
Streaming the data to a tmp file "/tnp/random-name" is the best bet.
it removes any complexity that might come up then trying to pipe the data
back into a file.
@Thorsten Moeller You should really think about getting the name of the
file before you write any data to it. You will have a stronger program if
you do.
On Thursday, March 7, 2013 10:15:04 AM UTC-5, Luke Arduini wrote:
>
> @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.