Skip to content

Innmind/io

Repository files navigation

io

Build Status codecov Type Coverage

High level abstraction to work with files and sockets in a declarative way.

Installation

composer require innmind/io

Usage

use Innmind\IO\IO;
use Innmind\Url\Path;
use Innmind\Immutable\Str;

$chunks = IO::fromAmbienAuthority()
    ->files()
    ->read(Path::of('/some/file.ext'))
    ->toEncoding(Str\Encoding::ascii)
    ->chunks(8192); // max length of each chunk

The $chunks variable is a Innmind\Innmutable\Sequence containing Innmind\Immutable\Str values, where each value is of a maximum length of 8192 bytes.

Documentation

Full documentation can be found at https://innmind.org/io/.