* 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. * * @param {string} path the path to t
(path)
| 108 | * contents as a buffer. |
| 109 | */ |
| 110 | getFile(path) { |
| 111 | let file = this.z_.file(path) |
| 112 | if (!file) { |
| 113 | return Promise.reject(new InvalidArgumentError(`No such file in zip archive: ${path}`)) |
| 114 | } |
| 115 | |
| 116 | if (file.dir) { |
| 117 | return Promise.reject(new InvalidArgumentError(`The requested file is a directory: ${path}`)) |
| 118 | } |
| 119 | |
| 120 | return Promise.resolve(file.async('nodebuffer')) |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Returns the compressed data for this archive in a buffer. _This method will |