php - Modificate files inside zip file , other way -
i need know if possible other way ............
i try modificate files inside zip file , try using class zip , works
$zip = new ziparchive; $res = $zip->open('test.zip'); if ($res === true) { $zip->extractto('./', 'test.txt'); $fp=fopen("test.txt","a"); fputs($fp,"hello"."\n"); fclose($fp); $zip->addfile('test.txt'); $zip->close(); unlink ("test.txt"); }
but question it´s if it´s posible no create temp file modificate, extract , repack , etc, , modificate inside of zip file target file want change
if no possible zip files no problem if can other file format tar , etc , need format let me compress many files inside , modificate in contents
thank´s best regards
if compress files (and change size within container), regular archive formats won't let modify files in-place, because modification cause size change , file won't fit well.
filesystems support per-file compression (ntfs, our solfs etc) compressing several blocks (sectors, pages) of file , trying put them smaller number of blocks. filesystems have free space. modification of file, when leads change of file size, causes blocks written different place other original sectors of disk.
this said, no compression file format work you. tar not compression format (i.e. files stored uncompressed) again if modify file , causes size change, tar won't help.
the option can see filesystem in file (eg. codebase filesystem, our solfs) supports compression. unfortunately neither codebase filesystem nor solfs have php interface.
Comments
Post a Comment