2017 © Pedro Peláez
 

library ar

Small lib for handling GNU ar files (i.e. .deb files)

image

tsg/ar

Small lib for handling GNU ar files (i.e. .deb files)

  • Tuesday, September 2, 2014
  • by silvervest
  • Repository
  • 3 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

AR archive file handling

Opening, reading and creating AR archives (like .deb files) in PHP, (*1)

Usage

Reading

Create a reader object:, (*2)

$ar = \Tsg\Ar\Reader::open('/path/to/file');

Get a list of files inside archive:, (*3)

$list = $ar->ls();

This returns an array of files in format:, (*4)

$list = [ 'filename' => [ 'fpos' => position in file, 'size' => size in bytes, 'uid' => user ID, 'gid' => group ID, 'mode' => file mode ] , ... ];

Retrieve a file's contents from inside archive:, (*5)

$data = $ar->get('filename');

This returns the data read directly from the file as found in the ls() method above. You can directly write this data to disk using fwrite() or file_put_contents(), (*6)

Writing

Create a writer object:, (*7)

$ar = \Tsg\Ar\Writer::create('/path/to/file');

Add a file to it:, (*8)

$ar->add('/path/to/file');

Or add multiple files at once using a glob:, (*9)

$ar->add('/path/to/files/*');

Or chain add files!, (*10)

$ar->add('1.file')->add('2.file')->add('3.file');

Then close the file, (*11)

$ar->close();

After the file is closed, it is ready to be used as a standard ar archive. You can confirm it's been written using the ar tool., (*12)

The Versions

02/09 2014

dev-master

9999999-dev

Small lib for handling GNU ar files (i.e. .deb files)

  Sources   Download

MIT

by Nick Silvestro