stephenh / ts-proto

An idiomatic protobuf generator for TypeScript
Apache License 2.0
2.18k stars 349 forks source link

Solution for streaming to a file? #1105

Open td-krzysiek opened 2 months ago

td-krzysiek commented 2 months ago

Hello,

We generate relatively large output files using ts-proto, and on some devices, creating the entire output buffer with *.finish() before saving it to a file may cause issues. Is there a solution where BinaryWriter writes directly to an output file stream instead of creating a Uint8Array?

I suppose it might be possible to extend BinaryWriter and implement all the functions myself, but it’s possible that someone else has already done this before.

Kind regards, Krzysztof

stephenh commented 2 months ago

Hi @td-krzysiek !

@timosaikkonen , per this ask, is it possible (or already exists?) to have a streaming version of BinaryWriter? Thanks!