ion-js icon indicating copy to clipboard operation
ion-js copied to clipboard

Writer close/getBytes Incongruent

Open almann opened this issue 6 years ago • 0 comments

Per #394 close() and getBytes() has a very coupled relationship. In a model where Writer delegates to some kind of I/O abstraction (e.g. an file, socket, or buffer), the concept of close or flush/finish makes sense. However, the current model is a buffer that is internal to the Writer itself, so it probably makes more sense to combine this into a single finish(): Uint8Array method.

Either way, we should be very clear about what happens after whatever APIs we end up here, for example, a hypothetical finish() would imply that writing is still allowed, but starts from a new IVM context, whereas close() would imply finish(), freeing up underlying resources and no longer being able to write data through the interface.

almann avatar Sep 11 '19 14:09 almann