PHP rar://


Introduction

The RAR (Roshal Archive) is file compression format that supports error recovery and file spanning. PHP supports use of .RAR files as IO stream. The rar:// is a stream wrapper for RAR streams.

rar:// wrapper takes the relative or absolute url encoded path to the RAR archive. An optional (*), or (#) and an optional url encoded entry name, as stored in the archive. This wrapper can open both files and directories.

If the pound sign and the entry name part are not included, the root of the archive will be displayed. The usage of the wrapper with RecursiveDirectoryIterator requires the number sign to be included in the URL.

This wrapper is not enabled by default. The rar extension available from PECL (PHP Extension Community Library) must be installed.

Usage

rar://<url encoded archive name>[*][#[<url encoded entry name>]]

RAR context options

open_passwordThe password used to encrypt the headers of the archive, if any.
file_passwordThe password used to encrypt a file, if any. If the headers are also encrypted, this option will be ignored in favor of open_password.
volume_callbackA callback to determine the path of missing volumes.

Updated on: 22-Sep-2020

213 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements