Last 12 weeks · 0 commits
2 of 6 standards met
What would you like to have changed? It's necessary to obtain a stream file inside of password-protected archive. Why is this feature a useful, necessary, and/or important addition to this project? To obtain a stream file inside a password-protected archive, you now need to extract it using third-party tools. What alternatives are there, or what are you doing in the meantime to work around the lack of this feature? I'm using C# language tools. Please link to any relevant issues, pull requests, or other discussions. I don't have this one.
Add function to map a into a list of entries. Fixes #61 The open question that remains is whether symlinks should be supported? As best as I can tell, this is possible as of Go 1.25 when is implemented by the FS, but that leaves the question about what should be done for Go 1.24 and below where this functionality does not exist? For this initial pass, I opted to return an error if the function comes across a symlink on the provided so we can talk about what is the appropriate way to handle this.
Repository: mholt/archives. Description: Cross-platform library to create & extract archives, compress & decompress files, and walk virtual file systems across various formats Stars: 382, Forks: 33. Primary language: Go. Languages: Go (100%). License: MIT. Homepage: https://pkg.go.dev/github.com/mholt/archives Topics: 7zip, archives, brotli, bzip2, compression, extract, fs, go, golang, gzip, lz4, lzip, rar, snappy, streams, tar, xz, zip, zlib, zstandard. Latest release: v0.1.5 (4mo ago). Open PRs: 1, open issues: 4. Last activity: 2mo ago. Community health: 57%. Top contributors: mholt, M0Rf30, sephriot, darkliquid, dpgarrick, dirkmueller, Gusted, joonas, mikelolasagasti, rgmz and others.
Go
Hardlink Support Implementation for mholt/archives (archive creation) Summary This branch adds proper hardlink detection and preservation for tar archives in the library during archive creation. Hardlinks are now correctly identified during file gathering and written to tar archives using entries, significantly reducing archive size for packages with many hardlinked files. Changes Made 1. Added hardlink detection to : Import for accessing inode information Track inodes using key to detect hardlinks When a file with is encountered: Check if the inode was seen before If yes, set to the first occurrence's path If no, record this path as the first occurrence Only check for symlinks if not already identified as a hardlink Code additions (~25 lines): 2. Modified to handle hardlinks: Distinguish between hardlinks and symlinks For hardlinks (LinkTarget set on regular files): Set Set Set (no content stored) Skip writing file content for TypeLink entries Code modifications (~20 lines): 3. (new file) Added comprehensive test coverage: : Verifies hardlink detection in : Verifies correct tar headers (TypeLink, zero size, Linkname) : Verifies hardlink metadata is preserved during extraction Results Tested with Git 2.50.1 for linux/amd64 (a package with 150 hardlinks): Extraction Support The extraction side already properly handles hardlinks: sets from Consumers can check Or check if for entries Platform Support Unix-like systems (Linux, macOS): Full support using Windows: May need additional implementation (current code uses ) Could add build tags: Or use conditional compilation Backward Compatibility ✅ No breaking API changes ✅ All existing tests pass ✅ Hardlink support is automatic (no configuration needed) ✅ Archives without hardlinks work exactly as before Testing Run tests: All tests pass, including: New hardlink tests All existing archive format tests fs.FS integration tests Future Considerations 1. Windows support: Add platform-specific hardlink detection 2. FilesFromFS: Add similar hardlink detection for fs.FS sources 3. Other formats: Consider hardlink support for zip (if format supports it) 4. Performance**: Inode tracking adds minimal overhead (O(n) map lookups) Related Issues This addresses the same issue as mholt/archiver PR #171 from 6 years ago, but implemented for the newer library.
What would you like to have changed? I would like to propose adding a function similar to that could be used to add files from a . If this is a reasonable proposal, I would be happy to take a pass at putting together a PR to implement it. Why is this feature a useful, necessary, and/or important addition to this project? Recently as I've been working with , I've ended up writing code that looks roughly something like this in tests: What I would love to be able to write instead is something that looks more like this (using for the setup): I am also wondering whether this might have uses beyond testing convenience. What alternatives are there, or what are you doing in the meantime to work around the lack of this feature? With a larger number of tests, writing custom test helpers can cut down on the boilerplate, but it would be nice to have this built-in so that every adopter of the library did not have to write their own. Please link to any relevant issues, pull requests, or other discussions.
Title: Issue with when filename contains a compression extension Description: I encountered an issue while using the function from the package. When the file name includes a compression extension (e.g., ), the function returns an error: . Here is the code snippet to reproduce the issue: Steps to Reproduce: 1. Open a zip file stream using . 2. Pass the filename with a compression extension (e.g., ) to . 3. Observe that the function returns an error ().