Rar ext

From: Date: Mon, 07 Jun 2004 07:41:01 +0000
Subject: Rar ext
Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-745@lists.php.net to get a copy of this message
Hi all! I've already got the bless from Wex and now I'm ready to show extension to the community. Rar extension is intended for read-only access to Rar archives (which were created by Rar or Winrar from rarlabs.com). Unrar, which is used by the extension, doesn't allow to create archives, but is free and allows redistribution of modified sources. Version 0.1 could be found here: http://tony2001.phpclub.net/rar/ Any comments will be appreciated. Simple example of usage: <? //open rar archive protected by password $rar = rar_open('/path/to/file.rar','password'); //get entry from the archive $entry = rar_entry_get($rar,'file/from/archive.txt'); //extract archive.txt to /dir/to $entry->extract('/dir/to'); //extract archive.txt to /new_file.txt $entry->extract(false,'/new_file.txt'); ?> Unfortunately, unrar doesn't permit to read archive entries, using something fread()-like, so you can only extract entries and get their properties. Another one simple example: <? //open rar archive $rar = rar_open('/path/to/file.rar'); //get entry from the archive $entry = rar_entry_get($rar,'file/from/archive.txt'); //print packed size echo $entry->getPackedSize(); //print unpacked size echo $entry->getUnpackedSize(); //etc. ?> p.s. I've already found, that I forgot to add basedir checks, they will be added soon. --- WBR, Antony Dovgal aka tony2001 tony2001@phpclub.net || antony@dovgal.com

« previous php.pecl.dev (#745) next »