定制 ntdash/zipstore 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ntdash/zipstore

最新稳定版本:v0.1.2

Composer 安装命令:

composer require ntdash/zipstore

包简介

a single level virtual zip store

README 文档

README

In a constraint environment where a storage is scarce, ZipStore allow us to load file into a a virtual store and to seek and read any bytes from any postion in the file as if you were seeking and reading a native resource (i.e: returned value of fopen())

ZipStore reduce the storage usage by only genrating the components of a the resulting zip file while reading the content of added files on the fly

Important

ZipStore, Even though convinient, does restrict you from delivering core features of a zip file, like encryption and content deflation, so it is to be use with the awarness of the limitation

Installation

  • php >=8.1 required
composer require ntdash/zip-store

Usage

Initialization

/* Typical initialization */
$store = new \ZipStore\Store();

Add file(s)

$store->addFile("map.json");

$store->addFiles([
    "video.webm",
    "sample.png"
]);

Ready to start reading

$openedStore = $store->open();

Seek and Read

/* offset retrieve from custom user logic or Request Range*/
$offset = ...; 
$bytes = 1024 * 1024 * 4;

$openStore->seek($offset);

$buff = $openStore->read($bytes);

/* both at the same time */
$buff2 = $openedStore->read($bytes, $offset);

/* number of bytes to be read is optionnal with a default of 1MiB */
$buff3 = $openedStore->read(offset: $offset);

Closing resources

yeah! you don't ! 'cause there is nothing to close

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-08