Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pmqs/archive-simplezip
Raku Module to Write Zip files
https://github.com/pmqs/archive-simplezip
bzip2 compression deflate perl6 perl6-module raku raku-module zip zipfile
Last synced: about 1 month ago
JSON representation
Raku Module to Write Zip files
- Host: GitHub
- URL: https://github.com/pmqs/archive-simplezip
- Owner: pmqs
- License: artistic-2.0
- Created: 2016-01-16T22:28:44.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-09-16T19:16:57.000Z (over 1 year ago)
- Last Synced: 2024-05-08T18:47:36.826Z (8 months ago)
- Topics: bzip2, compression, deflate, perl6, perl6-module, raku, raku-module, zip, zipfile
- Language: Perl
- Homepage:
- Size: 19.4 MB
- Stars: 1
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
# Archive::SimpleZip
Raku (Perl6) module to write Zip archives.
![Linux Build](https://github.com/pmqs/Archive-SimpleZip/actions/workflows/linux.yml/badge.svg)
![MacOS Build](https://github.com/pmqs/Archive-SimpleZip/actions/workflows/macos.yml/badge.svg)
![Windows Build](https://github.com/pmqs/Archive-SimpleZip/actions/workflows/windows.yml/badge.svg)## Synopsis
```
use Archive::SimpleZip;# Create a zip file in the filesystem
my $z = SimpleZip.new: "mine.zip";# Add a file to the zip archive
$z.add: "/some/file.txt";# Add multiple files in one step
# the 'add' method will consume anything that is an Iterable
$z.add: @list_of_files;# change the compression method to STORE
$z.add: 'somefile', :method(Zip-CM-Store);# add knows what to do with IO::Glob
use IO::Glob;
$z.add: glob("*.c");# add a file, but call it something different in the zip file
$z.add: "/some/file.txt", :name;# algorithmically rename the files by passing code to the name option
# in this instance chage file extension from '.tar.gz' to ;.tgz'
$z.add: @list_of_files, :name( *.subst(/'.tar.gz' $/, '.tgz') ), :method(Zip-CM-Store);# when used in a method chain it will accept an Iterable and output a Seq of filenames
# add all files matched by IO::Glob
glob("*.c").dir.$z ;# or like this
glob("*.c").$z ;# contrived example
glob("*.c").grep( ! *.d).$z.uc.sort.say;# Create a zip entry from a string/blob
$z.create(:name, "payload data here");
$z.create(:name, Blob.new([2,4,6]));# Drop a filehandle into the zip archive
my $handle = "/another/file".IO.open;
$z.create("data3", $handle);# use Associative interface to call 'create' behind the secenes
$z = "more payload";# can also use Associative interface to add a file from the filesystem
# just make sure it is of type IO
$z = "/real/file.txt".IO;# or a filehandle
$z = $handle;# create a directory
$z.mkdir: "dir1";$z.close;
```## Description
Simple write-only interface to allow creation of Zip files.
See the full documentation at the end of the file `lib/Archive/SimpleZip.rakumod`.
## Installation
Assuming you have a working Rakudo installation you should be able to install this with `zef` :
```
# From the source directoryzef install .
# Remote installation
zef install Archive::SimpleZip
```
## SupportSuggestions/patches are welcome at [Archive-SimpleZip](https://github.com/pmqs/Archive-SimpleZip)
## License
Please see the LICENSE file in the distribution
(C) Paul Marquess 2016-2023