承接 thruster/stream 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

thruster/stream

Composer 安装命令:

composer require thruster/stream

包简介

Thruster Steam Component

README 文档

README

[Latest Version] (https://github.com/ThrusterIO/stream/releases) [Software License] (LICENSE) [Build Status] (https://travis-ci.org/ThrusterIO/stream) [Code Coverage] (https://scrutinizer-ci.com/g/ThrusterIO/stream) [Quality Score] (https://scrutinizer-ci.com/g/ThrusterIO/stream) [Total Downloads] (https://packagist.org/packages/thruster/stream)

[Email] (mailto:team@thruster.io)

The Thruster Stream Component.

Basic readable and writable stream interfaces that support piping.

In order to make the event loop easier to use, this component introduces the concept of streams. They are very similar to the streams found in PHP itself, but have an interface more suited for async I/O.

Mainly it provides interfaces for readable and writable streams, plus a file descriptor based implementation with an in-memory write buffer.

Install

Via Composer

$ composer require thruster/stream

Readable Streams

EventEmitter Events

  • data: Emitted whenever data was read from the source.
  • end: Emitted when the source has reached the eof.
  • error: Emitted when an error occurs.
  • close: Emitted when the connection is closed.

Methods

  • isReadable(): Check if the stream is still in a state allowing it to be read from. It becomes unreadable when the connection ends, closes or an error occurs.
  • pause(): Remove the data source file descriptor from the event loop. This allows you to throttle incoming data.
  • resume(): Re-attach the data source after a pause().
  • pipe(WritableStreamInterface $dest, array $options = []): Pipe this readable stream into a writable stream. Automatically sends all incoming data to the destination. Automatically throttles based on what the destination can handle.

Writable Streams

EventEmitter Events

  • drain: Emitted if the write buffer became full previously and is now ready to accept more data.
  • error: Emitted whenever an error occurs.
  • close: Emitted whenever the connection is closed.
  • pipe: Emitted whenever a readable stream is pipe()d into this stream.

Methods

  • isWritable(): Check if the stream can still be written to. It cannot be written to after an error or when it is closed.
  • write($data): Write some data into the stream. If the stream cannot handle it, it should buffer the data or emit and error event. If the internal buffer is full after adding $data, write should return false, indicating that the caller should stop sending data until the buffer drains.
  • end($data = null): Optionally write some final data to the stream, empty the buffer, then close it.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

License

Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固