clue/tar-react 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

clue/tar-react

Composer 安装命令:

composer require clue/tar-react

包简介

Streaming parser to extract tarballs with ReactPHP.

README 文档

README

CI status installs on Packagist

Streaming parser to extract tarballs with ReactPHP.

The TAR file format is a common archive format to store several files in a single archive file (commonly referred to as "tarball" with a .tar extension). This lightweight library provides an efficient implementation to extract tarballs in a streaming fashion, processing one chunk at a time in memory without having to rely on disk I/O.

Table of Contents

Note: This project is in beta stage! Feel free to report any issues you encounter.

Quickstart example

Once installed, you can use the following code to pipe a readable tar stream into the TarDecoder which emits "entry" events for each individual file:

<?php

require __DIR__ . '/vendor/autoload.php';

$stream = new React\Stream\ReadableResourceStream(fopen('archive.tar', 'r'));

$decoder = new Clue\React\Tar\TarDecoder();

$decoder->on('entry', function (array $header, React\Stream\ReadableStreamInterface $file) {
    echo 'File ' . $header['filename'];
    echo ' (' . $header['size'] . ' bytes):' . PHP_EOL;

    $file->on('data', function ($chunk) {
        echo $chunk;
    });
});

$stream->pipe($decoder);

See also the examples.

Install

The recommended way to install this library is through Composer. New to Composer?

While in beta, this project does not currently follow SemVer. This will install the latest supported version:

composer require clue/tar-react:^0.2

See also the CHANGELOG for details about version upgrades.

This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 8+. It's highly recommended to use the latest supported PHP version for this project.

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:

composer install

To run the test suite, go to the project root and run:

vendor/bin/phpunit

License

This project is released under the permissive MIT license.

Did you know that I offer custom development services and issuing invoices for sponsorships of releases and for contributions? Contact me (@clue) for details.

More

  • If you want to learn more about processing streams of data, refer to the documentation of the underlying react/stream component.

  • If you want to process compressed tarballs (.tar.gz and .tgz file extension), you may want to use clue/reactphp-zlib on the compressed input stream before passing the decompressed stream to the tar decoder.

clue/tar-react 适用场景与选型建议

clue/tar-react 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.79k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2015 年 06 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「parser」 「decoder」 「async」 「extract」 「archive」 「tar」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 clue/tar-react 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 clue/tar-react 我们能提供哪些服务?
定制开发 / 二次开发

基于 clue/tar-react 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 13.79k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 21
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 4
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-17