@@ -11,15 +11,84 @@ import _testArchive from './testArchive.mjs';
11
11
import _updateArchive from './updateArchive.mjs' ;
12
12
import createSfx from './createSfx.mjs' ;
13
13
14
- class SevenZip {
15
- constructor ( ) { }
16
- }
14
+ function SevenZip ( ) { } ;
17
15
18
- export default SevenZip ;
16
+ /**
17
+ * Create/add content to an archive.
18
+ *
19
+ * @param filepath {string} Path to the archive.
20
+ * @param files {string|array} Files to add.
21
+ * @param options {Object} An object of acceptable 7-zip switch options.
22
+ * @param override {boolean} should binary directory change?
23
+ *
24
+ * @resolve {array} Arguments passed to the child-process.
25
+ * @progress {array} Listed files and directories.
26
+ * @reject {Error} The error as issued by 7-Zip.
27
+ *
28
+ * @returns {Promise } Promise
29
+ */
19
30
export const createArchive = SevenZip . createArchive = _createArchive ;
31
+
32
+ /**
33
+ * Delete content from an archive.
34
+ *
35
+ * @param filepath {string} Path to the archive.
36
+ * @param files {string|array} Files to remove.
37
+ * @param options {Object} An object of acceptable 7-zip switch options.
38
+ * @param override {boolean} should binary directory change?
39
+ *
40
+ * @resolve {array} Arguments passed to the child-process.
41
+ * @reject {Error} The error as issued by 7-Zip.
42
+ *
43
+ * @returns {Promise } Promise
44
+ */
20
45
export const deleteArchive = SevenZip . deleteArchive = _deleteArchive ;
46
+
47
+ /**
48
+ * Extract an archive.
49
+ *
50
+ * @param {string } archive Path to the archive.
51
+ * @param {string } dest Destination.
52
+ * @param options {Object} An object of acceptable 7-zip switch options.
53
+ * @param override {boolean} should binary directory change?
54
+ *
55
+ * @resolve {array} Arguments passed to the child-process.
56
+ * @progress {array} Extracted files and directories.
57
+ * @reject {Error} The error as issued by 7-Zip.
58
+ *
59
+ * @returns {Promise } Promise
60
+ */
21
61
export const extractArchive = SevenZip . extractArchive = _extractArchive ;
62
+
63
+ /**
64
+ * Extract an archive with full paths.
65
+ *
66
+ * @param filepath {string} Path to the archive.
67
+ * @param dest {string} Destination.
68
+ * @param options {Object} An object of acceptable 7-zip switch options.
69
+ * @param override {boolean} should binary directory change?
70
+ *
71
+ * @resolve {array} Arguments passed to the child-process.
72
+ * @progress {array} Extracted files and directories.
73
+ * @reject {Error} The error as issued by 7-Zip.
74
+ *
75
+ * @returns {Promise } Promise
76
+ */
22
77
export const fullArchive = SevenZip . fullArchive = _fullArchive ;
78
+
79
+ /**
80
+ * List contents of archive.
81
+ *
82
+ * @param filepath {string} Path to the archive.
83
+ * @param options {Object} An object of acceptable 7-zip switch options.
84
+ * @param override {boolean} should binary directory change?
85
+ *
86
+ * @progress {array} Listed files and directories.
87
+ * @resolve {Object} Tech spec about the archive.
88
+ * @reject {Error} The error as issued by 7-Zip.
89
+ *
90
+ * @returns {Promise } Promise
91
+ */
23
92
export const listArchive = SevenZip . listArchive = _listArchive ;
24
93
25
94
/**
@@ -38,8 +107,52 @@ export const listArchive = SevenZip.listArchive = _listArchive;
38
107
* @returns {Promise } Promise
39
108
*/
40
109
export const onlyArchive = SevenZip . onlyArchive = _onlyArchive ;
110
+
111
+ /**
112
+ * Renames files in archive.
113
+ *
114
+ * @param filepath {string} Path to the archive.
115
+ * @param files {string} Files pairs to rename in archive.
116
+ * @param options {Object} An object of acceptable 7-zip switch options.
117
+ * @param override {boolean} should binary directory change?
118
+ *
119
+ * @resolve {array} Arguments passed to the child-process.
120
+ * @progress {array} Listed files and directories.
121
+ * @reject {Error} The error as issued by 7-Zip.
122
+ *
123
+ * @returns {Promise } Promise
124
+ */
41
125
export const renameArchive = SevenZip . renameArchive = _renameArchive ;
126
+
127
+ /**
128
+ * Test integrity of archive.
129
+ *
130
+ * @param filepath {string} Path to the archive.
131
+ * @param options {Object} An object of acceptable 7-zip switch options.
132
+ * @param override {boolean} should binary directory change?
133
+ *
134
+ * @resolve {array} Arguments passed to the child-process.
135
+ * @progress {array} Extracted files and directories.
136
+ * @reject {Error} The error as issued by 7-Zip.
137
+ *
138
+ * @returns {Promise } Promise
139
+ */
42
140
export const testArchive = SevenZip . testArchive = _testArchive ;
141
+
142
+ /**
143
+ * Update content to an archive.
144
+ *
145
+ * @param filepath {string} Path to the archive.
146
+ * @param files {string} Files to update.
147
+ * @param options {Object} An object of acceptable 7-zip switch options.
148
+ * @param override {boolean} should binary directory change?
149
+ *
150
+ * @resolve {array} Arguments passed to the child-process.
151
+ * @progress {array} Listed files and directories.
152
+ * @reject {Error} The error as issued by 7-Zip.
153
+ *
154
+ * @returns {Promise } Promise
155
+ */
43
156
export const updateArchive = SevenZip . updateArchive = _updateArchive ;
44
157
45
158
export const createSfxWindows = SevenZip . windowsSfx = function ( name , files , destination , options , type ) {
@@ -53,3 +166,7 @@ export const createSfxLinux = SevenZip.linuxSfx = function (name, files, destina
53
166
export const createSfxMac = SevenZip . macSfx = function ( name , files , destination , options ) {
54
167
return createSfx ( name , files , destination , options , 'console' , 'darwin' , '.pkg' ) ;
55
168
} ;
169
+
170
+ export default SevenZip ;
171
+
172
+ export const Zip = SevenZip ;
0 commit comments