You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: implement binary format encoding/decoding for multi-file support (#37) (#45)
- Create lib/binary.ts with complete binary format implementation
- Add encodeFiles() function with magic number "GPST" and version support
- Add decodeFiles() function with comprehensive validation
- Add validateBinaryFormat() for quick format validation
- Add extractHeader() to read header without full decode
- Implement efficient binary packing with proper size limit enforcement
- Use specific error types instead of generic ValidationError
- Add comprehensive test suite with 35 tests covering:
- Normal operations (single/multiple files)
- Edge cases (empty files, Unicode, special characters)
- Error conditions and size limits
- Format validation and corruption detection
Binary format structure:
- 4 bytes: Magic number "GPST" (0x47505354)
- 1 byte: Version
- 2 bytes: File count
- 4 bytes: Total size
- Per file: filename length + name + content length + content + language
This implementation provides efficient multi-file packing while maintaining
data integrity and enforcing security limits.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments