zipfile

Compress into .zip file with node.js core zlib module

血红的双手。 提交于 2020-01-24 07:35:00
问题 How can I compress a file/files and save into a .zip extension file with the provided node.js zlib module? I figured how to save into .gz using gzip like the following: const gzip = zlib.createGzip(); const fs = require('fs'); const input = fs.createReadStream('myfile.txt'); const out = fs.createWriteStream('myfile.txt.gz'); input.pipe(gzip).pipe(out); 来源: https://stackoverflow.com/questions/48638885/compress-into-zip-file-with-node-js-core-zlib-module

Compress into .zip file with node.js core zlib module

若如初见. 提交于 2020-01-24 07:34:10
问题 How can I compress a file/files and save into a .zip extension file with the provided node.js zlib module? I figured how to save into .gz using gzip like the following: const gzip = zlib.createGzip(); const fs = require('fs'); const input = fs.createReadStream('myfile.txt'); const out = fs.createWriteStream('myfile.txt.gz'); input.pipe(gzip).pipe(out); 来源: https://stackoverflow.com/questions/48638885/compress-into-zip-file-with-node-js-core-zlib-module

zip many files with Air as3 flash

会有一股神秘感。 提交于 2020-01-17 04:12:55
问题 OK . I am reasonably capable, but still learning. This is for a program I am writing in AIR. Basicaly I am needing to grab the files of mixed type and content from a given folder and zip them. Here is the code I have put together and it sort of works. Problem I have is that the files in the zip all have zero byte's in them. Efectivly empty. What have I missed or done wrong? import flash.filesystem.File; import flash.events.Event; import deng.fzip.*; var directory:File = File.desktopDirectory

How to connect to a protected Sqlite3 database with Python

北慕城南 提交于 2020-01-15 09:45:06
问题 I created a SQLite3 database and protected it with a password ("test") thanks to the application DB browser for SQLite . In order to connect to my database via Python , I need to provide the password but I can't figure out how to do that. I tried the following code: conn=sqlite3.connect("mydatabase.db", Password="test") cur=conn.cursor() EDIT: My SQLite3 database has been encrypted with SQLCipher (see image). If I run the following code: conn=sqlite3.connect("mydatabase.db") cur=conn.cursor()

Python zipfile module erroneously thinks I have a zipfile that spans multiple disks, throws BadZipfile error

廉价感情. 提交于 2020-01-13 08:15:26
问题 I have a 1.4GB zip file and am trying to yield each member in succession. The zipfile module keeps throwing a BadZipfile exception, stating that "zipfile.BadZipfile: zipfiles that span multiple disks are not supported". Here is my code: import zipfile def iterate_members(zip_file_like_object): zflo = zip_file_like_object assert zipfile.is_zipfile(zflo) # Here is where the error happens. # If I comment out the assert, the same error gets thrown on this next line: with zipfile.ZipFile(zflo) as

How to get bytes/contents of each ZipFile entry from ZipInputStream without writing to outputstream?

对着背影说爱祢 提交于 2020-01-13 03:38:06
问题 I am trying to get the bytes of a particular file from the zipped file input stream. I have the input stream data of the Zipped file. From this I am getting the ZipEntry and writing the contents of each ZipEntry to a output stream and returning the byte buffer. This will return the buffer size output stream, but not the contents of each particular file. Is there a way I can convert the FileOutputStream to bytes or directly read the bytes of each ZipEntry? I need to return the ZipEntry

How to get bytes/contents of each ZipFile entry from ZipInputStream without writing to outputstream?

拥有回忆 提交于 2020-01-13 03:37:09
问题 I am trying to get the bytes of a particular file from the zipped file input stream. I have the input stream data of the Zipped file. From this I am getting the ZipEntry and writing the contents of each ZipEntry to a output stream and returning the byte buffer. This will return the buffer size output stream, but not the contents of each particular file. Is there a way I can convert the FileOutputStream to bytes or directly read the bytes of each ZipEntry? I need to return the ZipEntry

How to delete a zip file using php

荒凉一梦 提交于 2020-01-11 14:37:53
问题 This is my php code to delete a zip file: $name = "zip_file_name"; chmod('./modules/',0777); unlink('./modules/'.$name.'.zip'); Here modules is the folder of zip file contained. When I wrote this code I got an error: <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"> <h4>A PHP Error was encountered</h4> <p>Severity: Warning</p> <p>Message: unlink(./modules/texts.zip) [<a href='function.unlink'>function.unlink</a>]: Permission denied</p> <p>Filename: controllers/super

How to create ZipArchive from files in memory in C#?

隐身守侯 提交于 2020-01-10 13:05:21
问题 Is it somehow possible to create a ZipArchive from the file(s) in memory (and not actually on the disk). Following is the use case: Multiple files are received in an IEnumerable<HttpPostedFileBase> variable. I want to zip all these files together using ZipArchive . The problem is that ZipArchive only allows CreateEntryFromFile , which expects a path to the file, where as I just have the files in memory. Question: Is there a way to use a 'stream' to create the 'entry' in ZipArchive , so that I

How to create ZipArchive from files in memory in C#?

最后都变了- 提交于 2020-01-10 13:03:53
问题 Is it somehow possible to create a ZipArchive from the file(s) in memory (and not actually on the disk). Following is the use case: Multiple files are received in an IEnumerable<HttpPostedFileBase> variable. I want to zip all these files together using ZipArchive . The problem is that ZipArchive only allows CreateEntryFromFile , which expects a path to the file, where as I just have the files in memory. Question: Is there a way to use a 'stream' to create the 'entry' in ZipArchive , so that I