Skip to content

Implement Node streaming support#683

Open
markerikson wants to merge 7 commits intoantoniomuso:mainfrom
markerikson:feat/node-streaming
Open

Implement Node streaming support#683
markerikson wants to merge 7 commits intoantoniomuso:mainfrom
markerikson:feat/node-streaming

Conversation

@markerikson
Copy link

Per #429 (comment) , this PR contains AI-generated code (with human tweaks) to implement Node streaming support:

  • Updated package.json to change the generated bindings filenames from index.js/.d.ts to nativeBindings.js/.d.ts, to allow imports into the later stream JS files without circular import issues
  • Renamed the existing index files to nativeBindings, and added new index files that re-export everything
  • AI Added Rust streaming encoder/decoder implementations
  • AI Added JS streaming encoder/decoder implementations based on the ones in node-lz4
  • AI Added additional tests in index.spec.ts to verify the streaming implementation works
  • AI Added some example scripts to cross-check compatibility between node-lz4 and lz4-napi behavior

I can't guarantee all of this is 100% correct, and Claude at one point got confused over whether the streaming classes should use an "accumulate-then-compress" approach or a "true streaming" approach. The current implementation appears to use "accumulate-then-compress".

Hopefully this is at least useful as a baseline for implementing, if not actually usable on its own!

@antoniomuso antoniomuso force-pushed the feat/upgrade-napi-and-code branch 9 times, most recently from b7d661c to f5ab119 Compare August 30, 2025 09:28
@markerikson markerikson changed the base branch from feat/upgrade-napi-and-code to main September 2, 2025 15:49
@markerikson
Copy link
Author

Rebased this on top of the merged changes from #682

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant