Description
What is the problem this feature will solve?
This issue is to test the water a little bit.
Node supports zlib natively, which takes care of the compression / decompression aspect of sharing files, but it doesn’t include any primitive allowing to manipulate file archives of any kind. It can be implemented in userland (and in a project of mine we’re doing this by compiling the libzip to wasm), but it’s significantly slower (both in runtime, boot time, and size).
Being able to read file archives is especially useful when coupled with the ESM loaders, since it then becomes possible to implement loading modules straight from packaged vendors - a more performant alternative to bundled packages which doesn’t require to precompile the code and allows distributing it along with non-JS files.
What is the feature you are proposing to solve the problem?
I’d like to investigate whether it’d make sense to implement a basic archive manipulation library in Node.js. This isn’t unheard of, multiple interpreters having similar capabilities, sometimes even supporting multiple formats:
- PHP - https://www.php.net/manual/en/zip.examples.php
- Python - https://docs.python.org/3/library/zipfile.html
- Python (tar) - https://docs.python.org/3/library/tarfile.html
- Perl - https://perldoc.perl.org/IO::Compress::Zip
- Perl (tar) - https://perldoc.perl.org/Archive::Tar
- Go - https://pkg.go.dev/archive/[email protected]
- Go (tar) - https://pkg.go.dev/archive/[email protected]
- Java - https://docs.oracle.com/javase/7/docs/api/java/util/zip/package-summary.html
- C# - https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-compress-and-extract-files
The API of this basic archive library would be to define, but generally we can assume some simple requirements:
- Read an archive’s directory listing
- Stat files from within an archive
- Read a buffer from an archive
- Add a file to an archive
I’d be interested to explore an implementation myself.
What alternatives have you considered?
No response
@nodejs/zlib
Metadata
Metadata
Assignees
Labels
Type
Projects
Status