Idiomatic representation of { buffer, bytesRead }

Domenic Denicola d at domenic.me
Wed Mar 4 21:06:57 UTC 2015


Thanks very much for the feedback Jason!


> But you can support both, like this:
> 
>     pull(DataView) -> Promise<DataView>
>     pull(TypedArrayView) -> Promise<TypedArrayView of the same type>
> 
> A view argument conveniently provides just the three pieces of information
> you need, plus a type.

I thought of that. However, I found it a bit strange that passing this function a view onto bytes [256, 512] of a 1024-byte buffer would detach the entire 1024-byte buffer. What do you think?



More information about the es-discuss mailing list