innmind / encoding
1.1.0
2024-06-26 17:23 UTC
Requires
- php: ~8.2
- innmind/filesystem: ~7.1
- innmind/immutable: ~5.7
- innmind/time-continuum: ~3.4
Requires (Dev)
- innmind/black-box: ~5.5
- innmind/coding-standard: ~2.0
- vimeo/psalm: ~5.15
This package is auto-updated.
Last update: 2024-08-26 17:38:47 UTC
README
此软件包允许在无需将文件和目录写入文件系统且无需完全加载到内存的情况下对其进行编码和压缩。
注意 包含在
tar
文件中的每个文件都不能超过 8Go 大小。
安装
composer require innmind/encoding
用法
请查看文档以了解更深入的功能。
创建目录的存档
use Innmind\Filesystem\{ Adapter\Filesystem, Name, }; use Innmind\TimeContinuum\Earth; use Innmind\Url\Path; use Innmind\Encoding\{ Gzip, Tar, }; $adapter = Filesystem::mount(Path::of('some/directory/')); $tar = $adapter ->get(Name::of('data')) ->map(Tar::encode(new Earth\Clock)) ->map(Gzip::compress()) ->match( static fn($file) => $file, static fn() => null, );
在这里 $tar
代表一个包含从 sime/directory/data/
中所有文件和目录的 .tar.gz
文件,除非 data
不存在,那么它是 null
。