feat(bufio): Add React Native compatibility fixes#231
Merged
Conversation
- replace function.name references with string literals to avoid minification issues - replace BigInt exponentiation with precomputed constants for better performance - add Buffer.copy() fallback for React Native Buffer polyfills that lack copy method - maintain full backward compatibility with Node.js environments Fixes compatibility issues when using @node-dlc/bufio in React Native applications while preserving all existing functionality for Node.js users.
This was referenced Sep 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds React Native compatibility to the
@node-dlc/bufiopackage while maintaining full backward compatibility with Node.js environments.Changes Made
1. Function Name References → String Literals
this.methodName.namewith string literals (e.g.,'readUInt8')2. BigInt Performance Optimization
BigInt(2) ** BigInt(64)withBigInt('18446744073709551616')3. Buffer.copy() Compatibility
Buffer.copy()method with manual fallbackcopy()methodCompatibility
Testing
Files Changed
packages/bufio/lib/BufferReader.tspackages/bufio/lib/BufferWriter.tsThis eliminates the need for manual patches when using the library in React Native applications.