Hi folks

I'm currently in the process of writing a streaming email module (stream 
your text, HTML and attachments in and stream a nicely formatted email out 
to sendmail etc) and I'm currently deep in the middle of extracting lots of 
little streaming modules out before I finish what I started.

I've tried to keep the individual streams as simple as possible. For 
example, there's a quoted-printable stream that takes in text and blurts 
out quoted-printable (it's not a very good streaming module as it buffers 
all the chunks and then transforms the whole lot out before pushing it out 
- once I've finished the email-stream module, I'll go back to it) text. 
However, I've also put together a little streaming module that takes in 
text, plus a few details, and blurts out a MIME partial that's 
quoted-printable or base64 encoded. The intention is that multiple streams 
are then going to be used as inbound streams that make up a multipart 
stream.

I'm concerned that I'm embarking on a journey of anti-pattern madness 
though. I created the MIME partial stream as a duplex stream to encapsulate 
the process of 2 other transform streams in to one but I'm concerned that 
I'm missing an obvious pattern to achieve what I want. To explain what I 
want, let me give an example:

Imagine that I have my original stream of content A, and I want to get a 
MIME partial to incorporate in to a multi-part email. A first needs to pass 
through B in order to be converted in to quoted-printable/base64. Next it 
needs to pass through C to have any necessary headers/footers adding to it 
to become D. With bash, that would be:

A | B | C

Is there an established pattern/module/gist that can expose B | C as Z, a 
transform stream that can then be piped? As is usually the case when I 
write an email, I've already found an alternative design to achieve what I 
need without encapsulating a chain of duplex streams as its own module. I 
almost don't want to add any noise to this group, by posting this email, 
now that I've reconsidered it. I'm going to post it anyway as I'd still be 
interested to know your thoughts on whether it does seem a bit of an 
anti-pattern. 

Cheers,
connrs.

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