iqb/substream 问题修复 & 功能扩展

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

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

iqb/substream

最新稳定版本:v0.1

Composer 安装命令:

composer require iqb/substream

包简介

PHP stream wrapper for using only a portion of a stream.

README 文档

README

Build Status Code Coverage Software License

Issues/pull requests

This repository is a subtree split of the iqb/Morgue repository so it can be required as a standalone package via composer. To open an issues or pull request, please go to the iqb/Morgue repository.

Installation

Via composer:

composer require iqb/substream

Usage

The stream wrapper is registered for the iqb.substream:// protocol. To use as substream, just open a new like that:

use const iqb\stream\SUBSTREAM_SCHEME;

$originalStream = fopen('filename', 'r');
$offset = 25;
$length = 100;

// Provide the stream via a stream context
$context = stream_context_create([SUBSTREAM_SCHEME => ['stream' => $originalStream]]);
$substream = fopen(SUBSTREAM_SCHEME . "://$offset:$length", "r", false, $context);

// Alternatively, you can just put the stream into the URL
$substream = fopen(SUBSTREAM_SCHEME . "://$offset:$length/$originalStream", "r");

fseek($orignalStream, 50);
fseek($substream, 25);

// Will not fail
assert(fread($originalStream, 50) === fread($substream, 50));

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2018-04-13