wyrihaximus/react-stream-base64

为 ReactPHP 的 Base64 流编码/解码器

1.1.0 2019-01-01 17:38 UTC

README

Linux Build Status Latest Stable Version Total Downloads Code Coverage License PHP 7 ready

安装

通过 Composer 安装,使用以下命令,它将自动检测最新版本并将其绑定到 ^

composer require wyrihaximus/react-stream-base64 

用法

本包中所有流都是您想要编码或解码的流的装饰器。

可读流解码

$streamToDecode = new ThroughStream();
$stream = new ReadableStreamBase64Decode($streamToDecode);
$stream->on('data', function ($data) {
    echo $data; // foo.bar
});
$streamToDecode->write('Zm9vLmJhcg==');

可读流编码

$streamToEncode = new ThroughStream();
$stream = new ReadableStreamBase64Encode($streamToEncode);
$stream->on('data', function ($data) {
    echo $data; // Zm9vLmJhcg==
});
$streamToEncode->write('foo.bar');

可写流解码

$streamToDecode = new ThroughStream();
$stream = new WritableStreamBase64Decode($streamToDecode);
$stream->write('Zm9vLmJhcg=='); // Writes foo.bar to $streamToDecode

可写流编码

$streamToEncode = new ThroughStream();
$stream = new WritableStreamBase64Encode($streamToEncode);
$stream->write('foo.bar'); // Writes Zm9vLmJhcg== to $streamToEncode

贡献

请参阅 CONTRIBUTING 了解详细信息。

许可证

版权所有 2017 Cees-Jan Kiewiet

特此授予任何获得此软件及其相关文档副本(“软件”)的人免费使用权,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本,并允许向提供软件的人授予上述权利,但受以下条件约束

上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。

软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定用途适用性和非侵权性保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论是基于合同、侵权或其他原因,源于、源自或与软件或软件的使用或其他交易有关。