Oihana PHP

bunzip2File.php

Table of Contents

Functions

bunzip2File()  : string
Decompresses a single bzip2 file, streaming it in chunks.

Functions

bunzip2File()

Decompresses a single bzip2 file, streaming it in chunks.

bunzip2File(string $source[, string|null $destination = null ][, bool $overwrite = true ]) : string

Counterpart of bzip2File(), using the bz2 extension — no subprocess, and the file is never fully loaded into memory.

Parameters
$source : string

Path to the bzip2 file to decompress.

$destination : string|null = null

Output path. Defaults to $source without its .bz2 suffix, or $source + .out when the source has no .bz2 suffix.

$overwrite : bool = true

Whether to overwrite an existing destination (default: true).

Tags
throws
FileException

If the source is invalid, bz2 is unavailable, the destination exists and $overwrite is false, or decompression fails.

author

Marc Alcaraz (ekameleon)

since
1.2.0
example
use function oihana\files\bunzip2File;

bunzip2File( '/data/dump.sql.bz2' ) ; // -> /data/dump.sql
Return values
string

The destination path.

On this page

Search results