On Monday, September 22, 2014 8:37:57 AM UTC-4, Jesús Leganés Combarro 
wrote:
>
> I proposed this already as an issue on GitHub (
> https://github.com/joyent/node/issues/8415#issuecomment-56346468), but 
> seems it's more a convention and standarization thing.
>
> My idea is to add an optional .type attibute to Node.js streams so when 
> piping them it can be checked the format and adapt automatically if 
> possible or throw an error due to incompatible formats. This is inspired 
> by GStreamer Capabilities 
> <http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-caps-api.html>
>  and TermKit data streams headers 
> <https://github.com/unconed/TermKit/blob/master/Node-API.md#pipes>, and 
> would allow to process the streams metadata on heterogeneous environments 
> (like building pipelines dynamically) without needing to inspect them.
>
> This would only require that developers of the Writable streams set a 
> checker or adaptor function on the 'pipe' event, using the .type attribute 
> of both strems (themselves and the one they are being connected). The 
> format of the .type attribute would be a string or array of strings with 
> its MIME type, and when undefined/null/empty array it means accept 
> everything (no type specified), so it's backward compatible. For streams in 
> object mode, the .type attribute will have the MIME type of the individual 
> chunks on the data event when they are strings or buffer objects.
>
>
Interesting idea!

I'm not sure it fits at the same level as streams -- it's a much higher 
level concept, since streams don't represent files, always -- they're 
anything from TCP sockets to a lazy map-reduce chain, too.

It'd be interesting to see a few tools for checking things and see how it'd 
get used. If it's purely advisory, it can probably live outside the core 
distro entirely. 

Aria

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/d812d8ce-28c2-4cef-a5eb-7090e66f4e0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to