ziparchive

Nodejs and update file inside zip archive

余生颓废 提交于 2021-02-19 08:01:42
问题 I want update file in zip arhive with nodejs . For example i have zip file with two files: a.zip |-a.txt |-b.txt I use archiver: var archiver = require('archiver'); var archive = archiver('zip', {}); archive.pipe(fs.createWriteStream('./a.zip')); archive.append(fs.createReadStream('./c.txt'), { name: 't.txt' }); archive.finalize(); But I have a problem, my archive is completely overwritten. As a result, I get: a.zip |-t.txt If I use: archive.file('./a.txt', { name: 't.txt' }); the result

ZipArchive does not work in laravel

感情迁移 提交于 2020-03-22 09:40:09
问题 I have laravel project and whant to add feature for ziping files. I am using php ZipArchive. When I'm trying to create ZIP file using just PHP, I have luck, but when I'm trying with Laravel, zip files does not been created. So I have add: use ZipArchive; And just doing: $file_path = storage_path("creatives/helloworld.zip"); $zip = new ZipArchive(); $zip->open($file_path, ZipArchive::CREATE); But there is not error and no zip file. What can you advise me? 回答1: It is very late to reply but this

PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in

拈花ヽ惹草 提交于 2020-02-24 05:13:00
问题 I've been struggling with installing zip extension over PHP for a while now. I keep getting an error message while trying to use ZipArchive: PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in '...' The result of: php -m [PHP Modules] calendar Core ctype date dom exif fileinfo` filter ftp gd gettext hash iconv json libxml mbstring openssl pcntl pcre PDO Phar posix readline Reflection session shmop SimpleXML sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader

How to access a file in zipapp

℡╲_俬逩灬. 提交于 2020-01-24 14:08:42
问题 I've got a simple Python zipapp built with the following command: python -m pkg/ -c -o test -p '/usr/bin/python3' -m 'test:main' zipapp I would like to access the binary file from the script $ cat pkg/test.py def main(): with open('test.bin', 'rb') as f: print(f.name) Directory structure $ tree pkg/ pkg/ ├── test.bin └── test.py 0 directories, 2 files But it looks like the script is referring to a file from the current directory: $ ./test Traceback (most recent call last): File "/usr/lib64

php 7.2 ZipArchive class not having setEncryptionName function

巧了我就是萌 提交于 2020-01-03 02:29:10
问题 Have upgraded my php version from 5.6 to 7.2 but i dont see new php functions like setEncryptionName for ZipArchive class. i confirm this by echoing get_class_methods('zipArchive'). Do i need to do anything else in order to use the new set of functions the newer php version provides? Please help. 回答1: The ZipArchive class is part of the zip PECL extension for PHP You will need version 1.14.0 is higher for the setEncryptionName() function See changelog here: https://pecl.php.net/package/zip/1

“Include of non-modular header inside framework module” in C header of SSZipArchive

前提是你 提交于 2020-01-01 18:18:21
问题 I'm trying to use SSZipArchive objc library in my Swift iOS Project. What I did: Created an Objective-C "Cocoa Touch Framework" Followed this guide to import SSZipArchive's objective C and C files into it. Changed all C headers to public as per this answer Change build settings to allow non-modular includes as per this answer The framework compiles fine. I'd manage to use objective C libraries in Swift projects using this way before so I guess the steps are correct? The problem right now is

“Include of non-modular header inside framework module” in C header of SSZipArchive

我的未来我决定 提交于 2020-01-01 18:18:02
问题 I'm trying to use SSZipArchive objc library in my Swift iOS Project. What I did: Created an Objective-C "Cocoa Touch Framework" Followed this guide to import SSZipArchive's objective C and C files into it. Changed all C headers to public as per this answer Change build settings to allow non-modular includes as per this answer The framework compiles fine. I'd manage to use objective C libraries in Swift projects using this way before so I guess the steps are correct? The problem right now is

overwriting file in ziparchive

佐手、 提交于 2019-12-27 17:37:14
问题 I have archive.zip with two files: hello.txt and world.txt I want to overwrite hello.txt file with new one with that code: import zipfile z = zipfile.ZipFile('archive.zip','a') z.write('hello.txt') z.close() but it won't overwrite file, somehow it creates another instance of hello.txt — take a look at winzip screenshot: Since there is no smth like zipfile.remove() , what's the best way to handle this problem? 回答1: There's no way to do that with python zipfile module. You have to create a new

ZipArchive zip in linux corrupt in windows

房东的猫 提交于 2019-12-25 07:07:34
问题 I use ziparchive to zip my files in linux, and can't open in windows default zip uploader, I suspect it is caused by the file path during addfile e.g. $zip-addFile(‘/home/userName/public_html/gallery/license.txt’, ‘gallery/license.txt’); Suggestion from links below mention that I coudl remove the local path(as this can't be understood by windows), which becomes becomes $zip-addFile(‘/home/userName/public_html/gallery/license.txt’, ‘license.txt’); http://www.jacobbates.com/blog/2012/04/24