Archiever zip
RegisterCompressor registers or overrides a custom compressor for a specific method ID. If a compressor for a given method is not found, Writer will default to looking up the compressor at the package level.
SetOffset sets the offset of the beginning of the zip data within the underlying writer. It should be used when the zip data is appended to an existing file, such as a binary executable. It must be called before any data is written. Jump to New "zip: checksum error". Writer io. WriteCloser , error.
Reader io. ReadCloser , error. Reader , error. If zero, Store is used. Modified time. Open if err! CopyN os. Stdout, rc, 68 if err! Close fmt. Share Format Run. File , error. Create file.
Name if err! Write []byte file. Body if err! Close if err! Available to United States residents. By clicking sign up, I agree that I would like information, tips, and offers about Microsoft Store and other Microsoft products and services. Privacy Statement. Free Trial. Any Zip: Rar, Zip extractor and archiver. See System Requirements. Available on HoloLens. Show More. People also like. C Lite Browser Free. Flash Browser Free. Chromosome X Browser Free.
Omini Browser New Free. High-speed extracting and archiving. Able to open or create archive files with password protection. Additional information Published by AnywaySoft, Inc. This can make big differences in dealing with large files.
Currently, this defaults to 32K. This also changes the chunk size used for Compress::Raw::Zlib. You must call setChunkSize before reading or writing. This is not exportable, so you must call it like:.
Change the subroutine called with error strings. If myErrorHandler is undef, resets handler to default. Returns old error handler. Note that if you call Carp::carp or a similar routine or if you're chaining to the default error handler from your error handler, you may want to increment the number of caller levels that are skipped do not just set it to a number :.
Create a uniquely named temp file. If not given, creates the file using File::Spec::tmpdir. Generally, you can override this choice using the. But see the File::Spec documentation for your system. Returns file handle and name:. Return ref to member whose filename equals given filename or undef.
Return array of members whose filenames match given regular expression in list context. Returns number of matching members in scalar context. Gets the fields from the zip64 end of central directory record. These are always 0 if the archive is not in zip64 format. Return the disk that I start on.
Not used for writing zips, but might be interesting if you read a zip in. This should be 0, as Archive::Zip does not handle multi-volume archives. Return the disk number that holds the beginning of the central directory. Return the number of CD structures in the zipfile last read in. Returns central directory size, as read from an external zip file. Returns the offset into the zip file where the CD begins. Returns the unexpected number of bytes between where the EOCD was found and where it expected to be.
This is normally 0, but would be positive if something a virus, perhaps had added bytes somewhere before the EOCD. Here is an example of how you can diagnose this:. The eocdOffset is used to adjust the starting position of member headers, if necessary.
Returns the name of the file last read from. If nothing has been read yet, returns an empty string; if read from a file handle, returns the handle in string form.
Various operations on a zip file modify members. When a member is passed as an argument, you can either use a reference to the member itself, or the name of a member. Of course, using the name requires that names be unique within a zip this is not enforced. Remove and return the given member, or match its name and remove it. Returns undef if member or name does not exist in this Zip.
No-op if member does not belong to this zip. Replace with new member. Extract the given member, or match its name and extract it. Returns undef if member does not exist in this Zip. If optional second arg is given, use it as the name of the extracted member. Otherwise, the internal filename of the member is used as the name of the extracted file or directory. All necessary directories will be created. Does not use path information extracts into the current directory.
If optional second arg is given, use it as the name of the extracted member its paths will be deleted too. Otherwise, the internal filename of the member minus paths is used as the name of the extracted file or directory. Append a member possibly from another zip file to the zip file.
Returns the new member. Returns the possibly added or updated member, if any; undef on errors. The comparison is based on lastModTime and in the case of a non-directory the size of the file. Append a member whose data comes from an external file, returning the member or undef. The file attributes and last modification time will be set from the file.
If the name given does not represent a readable plain file or symbolic link, undef will be returned. The text mode bit will be set if the contents appears to be text as returned by the -T perl operator. NOTE that you should not generally use absolute path names in zip member names, as this will cause problems with some zip tools as well as introduce a security hole and make the zip harder to use.
Append a member created from the given directory name. The directory name does not have to name an existing directory. If the named directory exists, the file modification time and permissions are set from the existing directory, otherwise they are set to now and permissive default permissions.
If given, it must be in Zip Unix format. Append a member created from the given string or string reference. The name is given by the second argument. The last modification time will be set to now, and the file attributes will be set to permissive defaults. If called expecting an array as the return value, it will include the status as the second value in the array. Note that if you use the same name as an existing zip file that you read in, you will clobber ZipFileMembers.
So instead, write to a different file name, then delete the original. If you use the overwrite or overwriteAs methods, you can re-write the original zip in this way. Write a zip archive to a file handle. The optional second arg tells whether or not to try to seek backwards to re-write headers. If not provided, it is set if the Perl -f test returns true. This could fail on some operating systems, though. If you pass a file handle that is not seekable like if you're writing to a pipe or a socket , pass a false second argument:.
If this method fails during the write of a member, that member and all following it will return false from wasWritten. See writeCentralDirectory for a way to deal with this.
If you want, you can write data to the file handle before passing it to writeToFileHandle ; this could be used for instance for making self-extracting archives. This can be used for recovery in cases where writeToFileHandle or writeToFileNamed returns an IO error because of running out of space on the destination file. Write the zip to the specified file, as safely as possible.
This is done by first writing to a temp file, then renaming the original if it exists, then renaming the temp file, then deleting the renamed original if it exists. Write back to the original zip file. See overwriteAs above.
0コメント