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

Extract `LiteBuffer` polyfill to a sperate `rsocket-litebuffer` package

Open OlegDokuka opened this issue 4 years ago • 1 comments

Motivation

Currently, RSocket-Core implicitly brings a Buffer polyfill called LiteBuffer which is a minimalistic implementation of the Node Buffer and has a limited functionality surface to satisfy rsocket-js needs. Though it might be enough for us, for others it may be a limitation point that prevents implementing required business logic.

Desired solution

For that purpose, we have to separate LiteBuffer from the core to an external module and allow the user to bring the desired Buffer polyfill explicitly in the project dependencies

Additional context

For more info see #110

OlegDokuka avatar Dec 22 '20 13:12 OlegDokuka

Maybe for the 1.0 rewrite using UInt8Array and moving away from the Buffer api could be an option?

In #110 you mention that it increases complexity. But since the 1.0 rewrite is a effort to reduce the library to its core maybe it is worth the extra complexity (extra dependency in the browser vs a few bit operations?). In the "dev" branch there are already functions like "readUInt24BE" defined so maybe the complexity is already there anyway?

Maybe not using the Buffer API would reduce compatibility problems in the future when the library is used in the browser.

Or are there other specific reasons, just for my personal interest :) ?

freelancer1845 avatar Oct 15 '21 08:10 freelancer1845