Re: Splitting Stream into InputStream and OutputStream (was Re: CfC: publish WD of Streams API; deadline Nov 3)

On Thu, Oct 31, 2013 at 4:48 PM, François REMY <
francois.remy.dev@outlook.com> wrote:

>  Since JavaScript does not provide a way to check if an object implements
> an interface, there should probably exist a way to check that from the API,
> like:
>

Basically it should be sufficient if each API can check type, but yeah
probably useful.


>     var stream = InputStream(s) // returns “s” if it’s an input stream,
> convert is into a stream if possible, or return null
>    if(stream) { … } else { … }
>
> That’s a great way to convert a string into a stream, for example, in the
> case of an API that requires an InputStream and must integrate with older
> code that returns a String or a Blob.
>

Interesting. Maybe also accept an array of strings?

Received on Friday, 1 November 2013 03:32:39 UTC