https://github.com/nazar-pc/stream-slicer
Get slice of any seekable stream
https://github.com/nazar-pc/stream-slicer
Last synced: 6 months ago
JSON representation
Get slice of any seekable stream
- Host: GitHub
- URL: https://github.com/nazar-pc/stream-slicer
- Owner: nazar-pc
- License: mit
- Created: 2016-05-11T09:48:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-11T09:55:04.000Z (over 9 years ago)
- Last Synced: 2025-04-11T02:14:21.409Z (6 months ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
[](https://travis-ci.org/nazar-pc/stream-slicer)
## Stream slicer - Get slice of any seekable streamWhen working with PHP streams you sometimes need to have a slice of some stream.
For instance, you're parsing a huge multipart message with multiple uploaded files.
Obviously, you don't want to store gibibytes of data all in memory. so you're using stream and parse it piece by piece.
But when you encounter the beginning of large file within that stream you'll also want to avoid storing it into memory or copy to some place in addition to original data.
Unfortunately, PHP itself doesn't have primitive to create slice of that stream, but thanks to Stream slicer you can do it very easily.## Requirements:
* PHP 5.6+ or HHVM
## How to use?
Simply add dependency on `nazar-pc/stream-slicer` to your project's `composer.json`:
```json
{
"require": {
"nazar-pc/stream-slicer": "1.*"
}
}
``````php