Methods
addDir(dirPath, zipPathopt) → (non-null) {Promise.<?>}
Recursively adds a directory and all of its contents to this archive.
Name | Type | Attributes | Description |
---|---|---|---|
dirPath | string | path to the directory to add. | |
zipPath | string | <optional> | path to the folder in the archive to add the directory contents to. Defaults to the root folder. |
returns a promise that will resolve when the operation is complete.
- Type:
- Promise.<?>
addFile(filePath, zipPathopt) → (non-null) {Promise.<?>}
Adds a file to this zip.
Name | Type | Attributes | Description |
---|---|---|---|
filePath | string | path to the file to add. | |
zipPath | string | <optional> | path to the file in the zip archive, defaults to the basename of |
a promise that will resolve when added.
- Type:
- Promise.<?>
getFile(path) → (non-null) {Promise.<!Buffer>}
Returns the contents of the file in this zip archive with the given path
. The returned promise will be rejected with an InvalidArgumentError if either path
does not exist within the archive, or if path
refers to a directory.
Name | Type | Description |
---|---|---|
path | string | the path to the file whose contents to return. |
a promise that will be resolved with the file's contents as a buffer.
- Type:
- Promise.<!Buffer>
has(path) → {boolean}
Name | Type | Description |
---|---|---|
path | string | File path to test for within the archive. |
Whether this zip archive contains an entry with the given path.
- Type:
- boolean
toBuffer(compression) → (non-null) {Promise.<!Buffer>}
Returns the compressed data for this archive in a buffer. This method will not wait for any outstanding add operations before encoding the archive.
Name | Type | Default | Description |
---|---|---|---|
compression | string | STORE | The desired compression. Must be |
a promise that will resolve with this archive as a buffer.
- Type:
- Promise.<!Buffer>