-
Notifications
You must be signed in to change notification settings - Fork 13
API Documentation
This is the main object in the library and it's the object that you import in the require statment.
zips a given file/directory asynchronously.parameter path | buffer | unzippedfs String | Buffer | ZippedFS
: the path to the file/directory to be zipped, the buffer containing the file to be zipped or a ZippedFS form a previously unzipped file.
parameter callback | name Function | String
: the function to be called when the zipping is done or the name of the file in case a buffer is passed in the first argument.
parameter shiftedCallback Function
: the function to be called when the zipping is done in case a buffer is passed in the first argument.
The callback takes two arguments: a possible error and a ZipExport object.
unzips a given zip file asynchronously
parameter path | buffer String | Buffer
: the path to the zip file to be unzipped or the buffer containing it.
parameter callback Function
: the function to be called when the unzipping is done. It takes two arguments: a possible error and a ZipExport object.
zips a given file/directory synchronously
parameter path | buffer | unzippedfs String | Buffer | ZippedFS
: the path to the file/directory to be zipped, the buffer containing the file to be zipped or a ZippedFS form a previously unzipped file.
parameter name String
: the name of the file in case a buffer is passed in the first argument.
returns Object
: an instance of ZipExport object.
unzips a given zip file synchronously
parameter path | buffer String | Buffer
: the path to the zip file to be unzipped or the buffer containing it.
returns Object
: an instance of ZipExport object.
This object handles exporting the zipped/unzipped files. It is passed to callbacks of the asynchronous ZipLocal.zip
and ZipLocal.unzip
or returned from their synchronous versions.
returns Object
: instance of JSZip
object.
Review the JSZip API Documentation to know the provided low level operations.
sets the object so that the exported format will be compressed (only in context of zipping).
returns Object
: this instance of ZipExport
.
exports in memory by returning the zipped/unzipped file representation in memory.
returns Object
:
- instance of Buffer in zipping context.
- instnace of ZippedFS in unzipping context.
writes the zipped/unzipped file to disk
parameter path String
: the path to the save location. If this parameter was passed no argument or passed null
in the context of unzipping, the file will be extracted in the process's current working directory.
parameter callback Function
: the function to be called when saving is done (only in asynchronous context). The function is passed a possible error.
returns Array
: an array of the paths of files inside the unzipped file.
reads a file in the unzipped file by its path
parameter path String
: the path of the file to be read inside the unzipped file.
parameter type String
: the return type of the file, either 'text' or 'buffer'.
returns String || Buffer
: the contents of the file as either a string or buffer, depending on the passed type.