Popular recipes tagged "zip"http://code.activestate.com/recipes/tags/zip/2013-09-23T06:44:23-07:00ActiveState Code RecipesInMemoryZip class (Python) 2013-09-23T06:44:23-07:00Thomas Lehmannhttp://code.activestate.com/recipes/users/4174477/http://code.activestate.com/recipes/578667-inmemoryzip-class/ <p style="color: grey"> Python recipe 578667 by <a href="/recipes/users/4174477/">Thomas Lehmann</a> (<a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/memory/">memory</a>, <a href="/recipes/tags/path/">path</a>, <a href="/recipes/tags/zip/">zip</a>). </p> <p><strong>Why implementing this?</strong></p> <ul> <li>transfering a file or a folder (including sub folders) to another machine</li> <li>therefore zipping content to one compressed buffer</li> <li>keeping the relating ZIP in memory only but ...</li> <li>being able to save or load too</li> <li>and being able to unzip again at target destination</li> </ul> Create .CAB or .ZIP with batch (Batch) 2012-11-01T18:33:32-07:00greg zakharovhttp://code.activestate.com/recipes/users/4184115/http://code.activestate.com/recipes/578315-create-cab-or-zip-with-batch/ <p style="color: grey"> Batch recipe 578315 by <a href="/recipes/users/4184115/">greg zakharov</a> (<a href="/recipes/tags/cab/">cab</a>, <a href="/recipes/tags/cscript/">cscript</a>, <a href="/recipes/tags/zip/">zip</a>). </p> <p>Naturally, commnad language hasn't native methods to create archives but there is no obstacle to use JScript inside a batch. By the way, this do not need creation temporary files. OK, how does it work? Maybe you heard about conditional compilation in JScript, so you must be familiar with this trick. Take a look at this:</p> jardiff (Python) 2011-03-22T15:00:28-07:00Raphaël Jolivethttp://code.activestate.com/recipes/users/4135673/http://code.activestate.com/recipes/577620-jardiff/ <p style="color: grey"> Python recipe 577620 by <a href="/recipes/users/4135673/">Raphaël Jolivet</a> (<a href="/recipes/tags/diff/">diff</a>, <a href="/recipes/tags/jar/">jar</a>, <a href="/recipes/tags/war/">war</a>, <a href="/recipes/tags/zip/">zip</a>). </p> <p>Diff JAR / WAR / ZIP files (even recursively bundled).</p> <p>Possibility to ignore some files, or some patterns in text files (like MANIFEST.mf).</p> <p>This script is useful in order to know if a new build has changed anything to your binary JAR/WAR/Zip.</p> ZipScript: Build a directly executable zipped Python script set (Python) 2010-02-11T15:32:38-08:00Glennhttp://code.activestate.com/recipes/users/4171639/http://code.activestate.com/recipes/577042-zipscript-build-a-directly-executable-zipped-pytho/ <p style="color: grey"> Python recipe 577042 by <a href="/recipes/users/4171639/">Glenn</a> (<a href="/recipes/tags/package/">package</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/zip/">zip</a>). Revision 2. </p> <p>This function will package a python script and additional python modules, in either source or compiled form. Either are directly executable by Python 2.7/3.1 or newer.</p> <p>Uses make-like logic to only rebuild if something is newer than the previous build.</p> Reading large files from zip archive (Python) 2009-08-17T10:24:40-07:00Volker S.http://code.activestate.com/recipes/users/4171469/http://code.activestate.com/recipes/576882-reading-large-files-from-zip-archive/ <p style="color: grey"> Python recipe 576882 by <a href="/recipes/users/4171469/">Volker S.</a> (<a href="/recipes/tags/large_files/">large_files</a>, <a href="/recipes/tags/memory/">memory</a>, <a href="/recipes/tags/zip/">zip</a>). Revision 3. </p> <p>The standard zipfile module provides only a method to extract the entire content of a file from within a zip-file. This extension adds a generator method to iterate over the lines in a file, avoiding the memory problems.</p> xzip - Iterative zip function for very large collections (Python) 2009-03-30T14:54:40-07:00Tucker Beckhttp://code.activestate.com/recipes/users/4169378/http://code.activestate.com/recipes/576703-xzip-iterative-zip-function-for-very-large-collect/ <p style="color: grey"> Python recipe 576703 by <a href="/recipes/users/4169378/">Tucker Beck</a> (<a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/iterative_zip/">iterative_zip</a>, <a href="/recipes/tags/zip/">zip</a>). </p> <p>The xzip function provides the same functionality as zip (python builtin), but utilizes a generator list comprehension so that zipped collections can be accessed iteratively.</p> <p>Example: for t in xzip( xrange( 1000000 ), xrange( 1000000, 2000000, 1 ), xrange( 888,100000000, 1 ): print t</p> <p>This Will begin to produce output immediately, because the collections are zipped iteratively The output of this code is exactly equivalent to:</p> <p>for t in zip( xrange( 1000000 ), xrange( 1000000, 2000000, 1 ), xrange( 888,100000000, 1 ): print t</p> <p>However, the second block (using zip) must first build the zipped collection entirely before the for loop can iterate over it. This could take a long time.</p> <p>Note, I used xrange here so that we don't have to wait for python to build the initial lists. The xzip function would probably show its usefulness most if one had several huge collections that needed to be combined iteratively.</p> <p>I developed this function to zip long lists ( &gt;100000 ) of vertex triples with color triples in a volume visualizer.</p>