UNPKG

1.86 kBTypeScriptView Raw
1/**
2 * This file is part of the @egodigital/egoose distribution.
3 * Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
4 *
5 * @egodigital/egoose is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation, version 3.
8 *
9 * @egodigital/egoose is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17/// <reference types="node" />
18/**
19 * Builds a ZIP file.
20 */
21export declare class ZipBuilder {
22 private _buffer;
23 private readonly _STEPS;
24 /**
25 * Adds a buffer.
26 *
27 * @param {string} p The path in the zip file.
28 * @param {Buffer} data The data to write.
29 *
30 * @return this
31 */
32 addBuffer(p: string, data: Buffer): this;
33 /**
34 * Adds an empty directory.
35 *
36 * @param {string} p The path in the zip file.
37 *
38 * @return this
39 */
40 addDir(p: string): this;
41 /**
42 * Adds all files of a local directory.
43 *
44 * @param {string} dir The path of the local directory.
45 * @param {string} [basePath] The custom base (zip) path.
46 */
47 addFiles(dir: string, basePath?: string): this;
48 private createZipInstance;
49 /**
50 * Creates a new ZIP file as buffer.
51 *
52 * @return {Promise<Buffer>} The promise with the buffer.
53 */
54 toBuffer(): Promise<Buffer>;
55}
56/**
57 * Starts building a ZIP file.
58 *
59 * @return {ZipBuilder} The new builder instance.
60 */
61export declare function buildZip(): ZipBuilder;