@push.rocks/smartarchive 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/classes.archiveanalyzer.d.ts +1 -1
- package/dist_ts/classes.archiveanalyzer.js +34 -4
- package/dist_ts/classes.smartarchive.d.ts +151 -54
- package/dist_ts/classes.smartarchive.js +484 -234
- package/dist_ts/classes.tartools.d.ts +9 -33
- package/dist_ts/classes.tartools.js +18 -153
- package/dist_ts/index.d.ts +2 -6
- package/dist_ts/index.js +7 -11
- package/dist_ts/paths.js +1 -1
- package/dist_ts/plugins.d.ts +2 -9
- package/dist_ts/plugins.js +6 -13
- package/npmextra.json +13 -7
- package/package.json +23 -14
- package/readme.hints.md +69 -23
- package/readme.md +360 -274
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.archiveanalyzer.ts +33 -5
- package/ts/classes.smartarchive.ts +546 -256
- package/ts/classes.tartools.ts +20 -177
- package/ts/index.ts +7 -11
- package/ts/plugins.ts +5 -17
- package/{ts → ts_shared}/bzip2/bititerator.ts +1 -1
- package/{ts → ts_shared}/bzip2/bzip2.ts +2 -2
- package/{ts → ts_shared}/bzip2/index.ts +6 -6
- package/ts_shared/classes.bzip2tools.ts +14 -0
- package/ts_shared/classes.gziptools.ts +42 -0
- package/ts_shared/classes.tartools.ts +89 -0
- package/ts_shared/classes.ziptools.ts +107 -0
- package/ts_shared/index.ts +17 -0
- package/{ts → ts_shared}/interfaces.ts +23 -7
- package/ts_shared/plugins.ts +22 -0
- package/ts_web/00_commitinfo_data.ts +8 -0
- package/ts_web/index.ts +4 -0
- package/ts_web/plugins.ts +3 -0
- package/dist_ts/bzip2/bititerator.d.ts +0 -6
- package/dist_ts/bzip2/bititerator.js +0 -50
- package/dist_ts/bzip2/bzip2.d.ts +0 -29
- package/dist_ts/bzip2/bzip2.js +0 -398
- package/dist_ts/bzip2/index.d.ts +0 -5
- package/dist_ts/bzip2/index.js +0 -92
- package/dist_ts/classes.bzip2tools.d.ts +0 -7
- package/dist_ts/classes.bzip2tools.js +0 -11
- package/dist_ts/classes.gziptools.d.ts +0 -49
- package/dist_ts/classes.gziptools.js +0 -125
- package/dist_ts/classes.ziptools.d.ts +0 -56
- package/dist_ts/classes.ziptools.js +0 -185
- package/dist_ts/errors.d.ts +0 -44
- package/dist_ts/errors.js +0 -62
- package/dist_ts/interfaces.d.ts +0 -115
- package/dist_ts/interfaces.js +0 -2
- package/dist_ts/smartarchive.classes.smartarchive.d.ts +0 -34
- package/dist_ts/smartarchive.classes.smartarchive.js +0 -116
- package/dist_ts/smartarchive.paths.d.ts +0 -2
- package/dist_ts/smartarchive.paths.js +0 -4
- package/dist_ts/smartarchive.plugins.d.ts +0 -14
- package/dist_ts/smartarchive.plugins.js +0 -19
- package/ts/classes.bzip2tools.ts +0 -16
- package/ts/classes.gziptools.ts +0 -143
- package/ts/classes.ziptools.ts +0 -209
- /package/{ts → ts_shared}/errors.ts +0 -0
|
@@ -1,44 +1,20 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TCompressionLevel } from '../ts_shared/interfaces.js';
|
|
3
|
+
import { TarTools as SharedTarTools } from '../ts_shared/classes.tartools.js';
|
|
3
4
|
/**
|
|
4
|
-
* TAR archive
|
|
5
|
+
* Extended TAR archive utilities with Node.js filesystem support
|
|
5
6
|
*/
|
|
6
|
-
export declare class TarTools {
|
|
7
|
+
export declare class TarTools extends SharedTarTools {
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* Pack a directory into a TAR buffer (Node.js only)
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
fileName?: string;
|
|
12
|
-
content?: string | Buffer | plugins.stream.Readable | plugins.smartfile.SmartFile | plugins.smartfile.StreamFile;
|
|
13
|
-
byteLength?: number;
|
|
14
|
-
filePath?: string;
|
|
15
|
-
}): Promise<void>;
|
|
11
|
+
packDirectory(directoryPath: string): Promise<Uint8Array>;
|
|
16
12
|
/**
|
|
17
|
-
* Pack a directory into a TAR
|
|
13
|
+
* Pack a directory into a TAR.GZ buffer (Node.js only)
|
|
18
14
|
*/
|
|
19
|
-
|
|
15
|
+
packDirectoryToTarGz(directoryPath: string, compressionLevel?: TCompressionLevel): Promise<Uint8Array>;
|
|
20
16
|
/**
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
getPackStream(): Promise<plugins.tarStream.Pack>;
|
|
24
|
-
/**
|
|
25
|
-
* Get a TAR extraction stream
|
|
26
|
-
*/
|
|
27
|
-
getDecompressionStream(): plugins.tarStream.Extract;
|
|
28
|
-
/**
|
|
29
|
-
* Pack files into a TAR buffer
|
|
30
|
-
*/
|
|
31
|
-
packFiles(files: IArchiveEntry[]): Promise<Buffer>;
|
|
32
|
-
/**
|
|
33
|
-
* Pack a directory into a TAR.GZ buffer
|
|
34
|
-
*/
|
|
35
|
-
packDirectoryToTarGz(directoryPath: string, compressionLevel?: TCompressionLevel): Promise<Buffer>;
|
|
36
|
-
/**
|
|
37
|
-
* Pack a directory into a TAR.GZ stream
|
|
17
|
+
* Pack a directory into a TAR.GZ stream (Node.js only)
|
|
38
18
|
*/
|
|
39
19
|
packDirectoryToTarGzStream(directoryPath: string, compressionLevel?: TCompressionLevel): Promise<plugins.stream.Readable>;
|
|
40
|
-
/**
|
|
41
|
-
* Pack files into a TAR.GZ buffer
|
|
42
|
-
*/
|
|
43
|
-
packFilesToTarGz(files: IArchiveEntry[], compressionLevel?: TCompressionLevel): Promise<Buffer>;
|
|
44
20
|
}
|
|
@@ -1,175 +1,40 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
|
-
import {
|
|
2
|
+
import { TarTools as SharedTarTools } from '../ts_shared/classes.tartools.js';
|
|
3
|
+
import { GzipTools } from '../ts_shared/classes.gziptools.js';
|
|
3
4
|
/**
|
|
4
|
-
* TAR archive
|
|
5
|
+
* Extended TAR archive utilities with Node.js filesystem support
|
|
5
6
|
*/
|
|
6
|
-
export class TarTools {
|
|
7
|
+
export class TarTools extends SharedTarTools {
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
async addFileToPack(pack, optionsArg) {
|
|
11
|
-
return new Promise(async (resolve, reject) => {
|
|
12
|
-
let fileName = null;
|
|
13
|
-
if (optionsArg.fileName) {
|
|
14
|
-
fileName = optionsArg.fileName;
|
|
15
|
-
}
|
|
16
|
-
else if (optionsArg.content instanceof plugins.smartfile.SmartFile) {
|
|
17
|
-
fileName = optionsArg.content.relative;
|
|
18
|
-
}
|
|
19
|
-
else if (optionsArg.content instanceof plugins.smartfile.StreamFile) {
|
|
20
|
-
fileName = optionsArg.content.relativeFilePath;
|
|
21
|
-
}
|
|
22
|
-
else if (optionsArg.filePath) {
|
|
23
|
-
fileName = optionsArg.filePath;
|
|
24
|
-
}
|
|
25
|
-
if (!fileName) {
|
|
26
|
-
reject(new Error('No filename specified for TAR entry'));
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// Determine content byte length
|
|
30
|
-
let contentByteLength;
|
|
31
|
-
if (optionsArg.byteLength) {
|
|
32
|
-
contentByteLength = optionsArg.byteLength;
|
|
33
|
-
}
|
|
34
|
-
else if (typeof optionsArg.content === 'string') {
|
|
35
|
-
contentByteLength = Buffer.byteLength(optionsArg.content, 'utf8');
|
|
36
|
-
}
|
|
37
|
-
else if (Buffer.isBuffer(optionsArg.content)) {
|
|
38
|
-
contentByteLength = optionsArg.content.length;
|
|
39
|
-
}
|
|
40
|
-
else if (optionsArg.content instanceof plugins.smartfile.SmartFile) {
|
|
41
|
-
contentByteLength = await optionsArg.content.getSize();
|
|
42
|
-
}
|
|
43
|
-
else if (optionsArg.content instanceof plugins.smartfile.StreamFile) {
|
|
44
|
-
contentByteLength = await optionsArg.content.getSize();
|
|
45
|
-
}
|
|
46
|
-
else if (optionsArg.filePath) {
|
|
47
|
-
const fileStat = await plugins.fsPromises.stat(optionsArg.filePath);
|
|
48
|
-
contentByteLength = fileStat.size;
|
|
49
|
-
}
|
|
50
|
-
// Convert all content types to Readable stream
|
|
51
|
-
let content;
|
|
52
|
-
if (Buffer.isBuffer(optionsArg.content)) {
|
|
53
|
-
content = plugins.stream.Readable.from(optionsArg.content);
|
|
54
|
-
}
|
|
55
|
-
else if (typeof optionsArg.content === 'string') {
|
|
56
|
-
content = plugins.stream.Readable.from(Buffer.from(optionsArg.content));
|
|
57
|
-
}
|
|
58
|
-
else if (optionsArg.content instanceof plugins.smartfile.SmartFile) {
|
|
59
|
-
content = plugins.stream.Readable.from(optionsArg.content.contents);
|
|
60
|
-
}
|
|
61
|
-
else if (optionsArg.content instanceof plugins.smartfile.StreamFile) {
|
|
62
|
-
content = await optionsArg.content.createReadStream();
|
|
63
|
-
}
|
|
64
|
-
else if (optionsArg.content instanceof plugins.stream.Readable) {
|
|
65
|
-
content = optionsArg.content;
|
|
66
|
-
}
|
|
67
|
-
else if (optionsArg.filePath) {
|
|
68
|
-
content = plugins.fs.createReadStream(optionsArg.filePath);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
reject(new Error('No content or filePath specified for TAR entry'));
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const entry = pack.entry({
|
|
75
|
-
name: fileName,
|
|
76
|
-
...(contentByteLength !== undefined ? { size: contentByteLength } : {}),
|
|
77
|
-
}, (err) => {
|
|
78
|
-
if (err) {
|
|
79
|
-
reject(err);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
resolve();
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
content.pipe(entry);
|
|
86
|
-
// Note: resolve() is called in the callback above when pipe completes
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Pack a directory into a TAR stream
|
|
9
|
+
* Pack a directory into a TAR buffer (Node.js only)
|
|
91
10
|
*/
|
|
92
11
|
async packDirectory(directoryPath) {
|
|
93
12
|
const fileTree = await plugins.listFileTree(directoryPath, '**/*');
|
|
94
|
-
const
|
|
13
|
+
const entries = [];
|
|
95
14
|
for (const filePath of fileTree) {
|
|
96
15
|
const absolutePath = plugins.path.join(directoryPath, filePath);
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
fileName: filePath,
|
|
102
|
-
content: plugins.fs.createReadStream(absolutePath),
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return pack;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Get a new TAR pack stream
|
|
109
|
-
*/
|
|
110
|
-
async getPackStream() {
|
|
111
|
-
return plugins.tarStream.pack();
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Get a TAR extraction stream
|
|
115
|
-
*/
|
|
116
|
-
getDecompressionStream() {
|
|
117
|
-
return plugins.tarStream.extract();
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Pack files into a TAR buffer
|
|
121
|
-
*/
|
|
122
|
-
async packFiles(files) {
|
|
123
|
-
const pack = await this.getPackStream();
|
|
124
|
-
for (const file of files) {
|
|
125
|
-
await this.addFileToPack(pack, {
|
|
126
|
-
fileName: file.archivePath,
|
|
127
|
-
content: file.content,
|
|
128
|
-
byteLength: file.size,
|
|
16
|
+
const content = await plugins.fsPromises.readFile(absolutePath);
|
|
17
|
+
entries.push({
|
|
18
|
+
archivePath: filePath,
|
|
19
|
+
content: new Uint8Array(content),
|
|
129
20
|
});
|
|
130
21
|
}
|
|
131
|
-
|
|
132
|
-
const chunks = [];
|
|
133
|
-
return new Promise((resolve, reject) => {
|
|
134
|
-
pack.on('data', (chunk) => chunks.push(chunk));
|
|
135
|
-
pack.on('end', () => resolve(Buffer.concat(chunks)));
|
|
136
|
-
pack.on('error', reject);
|
|
137
|
-
});
|
|
22
|
+
return this.packFiles(entries);
|
|
138
23
|
}
|
|
139
24
|
/**
|
|
140
|
-
* Pack a directory into a TAR.GZ buffer
|
|
25
|
+
* Pack a directory into a TAR.GZ buffer (Node.js only)
|
|
141
26
|
*/
|
|
142
27
|
async packDirectoryToTarGz(directoryPath, compressionLevel) {
|
|
143
|
-
const
|
|
144
|
-
pack.finalize();
|
|
28
|
+
const tarBuffer = await this.packDirectory(directoryPath);
|
|
145
29
|
const gzipTools = new GzipTools();
|
|
146
|
-
|
|
147
|
-
const chunks = [];
|
|
148
|
-
return new Promise((resolve, reject) => {
|
|
149
|
-
pack
|
|
150
|
-
.pipe(gzipStream)
|
|
151
|
-
.on('data', (chunk) => chunks.push(chunk))
|
|
152
|
-
.on('end', () => resolve(Buffer.concat(chunks)))
|
|
153
|
-
.on('error', reject);
|
|
154
|
-
});
|
|
30
|
+
return gzipTools.compress(tarBuffer, compressionLevel);
|
|
155
31
|
}
|
|
156
32
|
/**
|
|
157
|
-
* Pack a directory into a TAR.GZ stream
|
|
33
|
+
* Pack a directory into a TAR.GZ stream (Node.js only)
|
|
158
34
|
*/
|
|
159
35
|
async packDirectoryToTarGzStream(directoryPath, compressionLevel) {
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
const gzipTools = new GzipTools();
|
|
163
|
-
const gzipStream = gzipTools.getCompressionStream(compressionLevel);
|
|
164
|
-
return pack.pipe(gzipStream);
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Pack files into a TAR.GZ buffer
|
|
168
|
-
*/
|
|
169
|
-
async packFilesToTarGz(files, compressionLevel) {
|
|
170
|
-
const tarBuffer = await this.packFiles(files);
|
|
171
|
-
const gzipTools = new GzipTools();
|
|
172
|
-
return gzipTools.compress(tarBuffer, compressionLevel);
|
|
36
|
+
const buffer = await this.packDirectoryToTarGz(directoryPath, compressionLevel);
|
|
37
|
+
return plugins.stream.Readable.from(buffer);
|
|
173
38
|
}
|
|
174
39
|
}
|
|
175
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJ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Q0FBQztJQUNqQyxDQUFDO0lBRUQ7O09BRUc7SUFDSSxLQUFLLENBQUMsb0JBQW9CLENBQy9CLGFBQXFCLEVBQ3JCLGdCQUFvQztRQUVwQyxNQUFNLFNBQVMsR0FBRyxNQUFNLElBQUksQ0FBQyxhQUFhLENBQUMsYUFBYSxDQUFDLENBQUM7UUFDMUQsTUFBTSxTQUFTLEdBQUcsSUFBSSxTQUFTLEVBQUUsQ0FBQztRQUNsQyxPQUFPLFNBQVMsQ0FBQyxRQUFRLENBQUMsU0FBUyxFQUFFLGdCQUFnQixDQUFDLENBQUM7SUFDekQsQ0FBQztJQUVEOztPQUVHO0lBQ0ksS0FBSyxDQUFDLDBCQUEwQixDQUNyQyxhQUFxQixFQUNyQixnQkFBb0M7UUFFcEMsTUFBTSxNQUFNLEdBQUcsTUFBTSxJQUFJLENBQUMsb0JBQW9CLENBQUMsYUFBYSxFQUFFLGdCQUFnQixDQUFDLENBQUM7UUFDaEYsT0FBTyxPQUFPLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDOUMsQ0FBQztDQUNGIn0=
|
package/dist_ts/index.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export * from './errors.js';
|
|
1
|
+
export * from '../ts_shared/index.js';
|
|
3
2
|
export * from './classes.smartarchive.js';
|
|
4
|
-
export * from './classes.tartools.js';
|
|
5
|
-
export * from './classes.ziptools.js';
|
|
6
|
-
export * from './classes.gziptools.js';
|
|
7
|
-
export * from './classes.bzip2tools.js';
|
|
8
3
|
export * from './classes.archiveanalyzer.js';
|
|
4
|
+
export { TarTools } from './classes.tartools.js';
|
package/dist_ts/index.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
//
|
|
2
|
-
export * from '
|
|
3
|
-
|
|
4
|
-
// Main archive class
|
|
1
|
+
// Re-export everything from ts_shared (browser-compatible)
|
|
2
|
+
export * from '../ts_shared/index.js';
|
|
3
|
+
// Node.js-specific: Main archive class with filesystem support
|
|
5
4
|
export * from './classes.smartarchive.js';
|
|
6
|
-
//
|
|
7
|
-
export * from './classes.tartools.js';
|
|
8
|
-
export * from './classes.ziptools.js';
|
|
9
|
-
export * from './classes.gziptools.js';
|
|
10
|
-
export * from './classes.bzip2tools.js';
|
|
11
|
-
// Archive analysis
|
|
5
|
+
// Node.js-specific: Archive analysis with SmartArchive integration
|
|
12
6
|
export * from './classes.archiveanalyzer.js';
|
|
13
|
-
|
|
7
|
+
// Node.js-specific: Extended TarTools with filesystem support (overrides shared TarTools)
|
|
8
|
+
export { TarTools } from './classes.tartools.js';
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyREFBMkQ7QUFDM0QsY0FBYyx1QkFBdUIsQ0FBQztBQUV0QywrREFBK0Q7QUFDL0QsY0FBYywyQkFBMkIsQ0FBQztBQUUxQyxtRUFBbUU7QUFDbkUsY0FBYyw4QkFBOEIsQ0FBQztBQUU3QywwRkFBMEY7QUFDMUYsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLHVCQUF1QixDQUFDIn0=
|
package/dist_ts/paths.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
2
|
export const packageDir = plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
|
|
3
3
|
export const nogitDir = plugins.path.join(packageDir, './.nogit');
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF0aHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9wYXRocy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGNBQWMsQ0FBQztBQUV4QyxNQUFNLENBQUMsTUFBTSxVQUFVLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQ3pDLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLHdCQUF3QixDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQy9ELEtBQUssQ0FDTixDQUFDO0FBQ0YsTUFBTSxDQUFDLE1BQU0sUUFBUSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFVBQVUsRUFBRSxVQUFVLENBQUMsQ0FBQyJ9
|
package/dist_ts/plugins.d.ts
CHANGED
|
@@ -7,17 +7,10 @@ export { path, stream, fs, fsPromises };
|
|
|
7
7
|
* List files in a directory recursively, returning relative paths
|
|
8
8
|
*/
|
|
9
9
|
export declare function listFileTree(dirPath: string, _pattern?: string): Promise<string[]>;
|
|
10
|
-
|
|
11
|
-
import * as smartdelay from '@push.rocks/smartdelay';
|
|
10
|
+
export * from '../ts_shared/plugins.js';
|
|
12
11
|
import * as smartpath from '@push.rocks/smartpath';
|
|
13
|
-
import * as smartpromise from '@push.rocks/smartpromise';
|
|
14
12
|
import * as smartrequest from '@push.rocks/smartrequest';
|
|
15
13
|
import * as smartunique from '@push.rocks/smartunique';
|
|
16
|
-
import * as smartstream from '@push.rocks/smartstream';
|
|
17
14
|
import * as smartrx from '@push.rocks/smartrx';
|
|
18
15
|
import * as smarturl from '@push.rocks/smarturl';
|
|
19
|
-
export {
|
|
20
|
-
import * as fileType from 'file-type';
|
|
21
|
-
import * as fflate from 'fflate';
|
|
22
|
-
import tarStream from 'tar-stream';
|
|
23
|
-
export { fileType, fflate, tarStream };
|
|
16
|
+
export { smartpath, smartrequest, smartunique, smartrx, smarturl, };
|
package/dist_ts/plugins.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Node.js native scope
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import * as stream from 'node:stream';
|
|
4
4
|
import * as fs from 'node:fs';
|
|
@@ -25,20 +25,13 @@ export async function listFileTree(dirPath, _pattern = '**/*') {
|
|
|
25
25
|
await walkDir(dirPath);
|
|
26
26
|
return results;
|
|
27
27
|
}
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
// Re-export browser-compatible plugins from ts_shared
|
|
29
|
+
export * from '../ts_shared/plugins.js';
|
|
30
|
+
// Additional Node.js-specific @pushrocks packages
|
|
31
31
|
import * as smartpath from '@push.rocks/smartpath';
|
|
32
|
-
import * as smartpromise from '@push.rocks/smartpromise';
|
|
33
32
|
import * as smartrequest from '@push.rocks/smartrequest';
|
|
34
33
|
import * as smartunique from '@push.rocks/smartunique';
|
|
35
|
-
import * as smartstream from '@push.rocks/smartstream';
|
|
36
34
|
import * as smartrx from '@push.rocks/smartrx';
|
|
37
35
|
import * as smarturl from '@push.rocks/smarturl';
|
|
38
|
-
export {
|
|
39
|
-
|
|
40
|
-
import * as fileType from 'file-type';
|
|
41
|
-
import * as fflate from 'fflate';
|
|
42
|
-
import tarStream from 'tar-stream';
|
|
43
|
-
export { fileType, fflate, tarStream };
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3BsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsb0JBQW9CO0FBQ3BCLE9BQU8sS0FBSyxJQUFJLE1BQU0sV0FBVyxDQUFDO0FBQ2xDLE9BQU8sS0FBSyxNQUFNLE1BQU0sYUFBYSxDQUFDO0FBQ3RDLE9BQU8sS0FBSyxFQUFFLE1BQU0sU0FBU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|
@@ -25,9 +21,19 @@
|
|
|
25
21
|
"data analysis",
|
|
26
22
|
"file stream"
|
|
27
23
|
]
|
|
24
|
+
},
|
|
25
|
+
"release": {
|
|
26
|
+
"registries": [
|
|
27
|
+
"https://verdaccio.lossless.digital",
|
|
28
|
+
"https://registry.npmjs.org"
|
|
29
|
+
],
|
|
30
|
+
"accessLevel": "public"
|
|
28
31
|
}
|
|
29
32
|
},
|
|
30
|
-
"tsdoc": {
|
|
33
|
+
"@git.zone/tsdoc": {
|
|
31
34
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
|
35
|
+
},
|
|
36
|
+
"@ship.zone/szci": {
|
|
37
|
+
"npmGlobalTools": []
|
|
32
38
|
}
|
|
33
|
-
}
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@push.rocks/smartarchive",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "A library for working with archive files, providing utilities for compressing and decompressing data.",
|
|
5
5
|
"main": "dist_ts/index.js",
|
|
6
6
|
"typings": "dist_ts/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist_ts/index.js",
|
|
10
|
+
"./web": "./dist_ts_web/index.js"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "(tstest test/ --verbose)",
|
|
14
|
+
"build": "tsbuild --web --allowimplicitany",
|
|
15
|
+
"buildDocs": "tsdoc"
|
|
16
|
+
},
|
|
8
17
|
"repository": {
|
|
9
18
|
"type": "git",
|
|
10
19
|
"url": "https://code.foss.global/push.rocks/smartarchive.git"
|
|
@@ -17,31 +26,32 @@
|
|
|
17
26
|
"homepage": "https://code.foss.global/push.rocks/smartarchive#readme",
|
|
18
27
|
"dependencies": {
|
|
19
28
|
"@push.rocks/smartdelay": "^3.0.5",
|
|
20
|
-
"@push.rocks/smartfile": "^13.
|
|
29
|
+
"@push.rocks/smartfile": "^13.1.2",
|
|
21
30
|
"@push.rocks/smartpath": "^6.0.0",
|
|
22
31
|
"@push.rocks/smartpromise": "^4.2.3",
|
|
23
|
-
"@push.rocks/smartrequest": "^
|
|
32
|
+
"@push.rocks/smartrequest": "^5.0.1",
|
|
24
33
|
"@push.rocks/smartrx": "^3.0.10",
|
|
25
34
|
"@push.rocks/smartstream": "^3.2.5",
|
|
26
35
|
"@push.rocks/smartunique": "^3.0.9",
|
|
27
36
|
"@push.rocks/smarturl": "^3.1.0",
|
|
28
|
-
"@types/tar-stream": "^3.1.4",
|
|
29
37
|
"fflate": "^0.8.2",
|
|
30
|
-
"file-type": "^21.
|
|
31
|
-
"tar
|
|
38
|
+
"file-type": "^21.2.0",
|
|
39
|
+
"modern-tar": "^0.7.3"
|
|
32
40
|
},
|
|
33
41
|
"devDependencies": {
|
|
34
|
-
"@git.zone/tsbuild": "^
|
|
35
|
-
"@git.zone/tsrun": "^2.0.
|
|
36
|
-
"@git.zone/tstest": "^3.1.
|
|
42
|
+
"@git.zone/tsbuild": "^4.0.2",
|
|
43
|
+
"@git.zone/tsrun": "^2.0.1",
|
|
44
|
+
"@git.zone/tstest": "^3.1.4"
|
|
37
45
|
},
|
|
38
46
|
"private": false,
|
|
39
47
|
"files": [
|
|
40
48
|
"ts/**/*",
|
|
49
|
+
"ts_shared/**/*",
|
|
41
50
|
"ts_web/**/*",
|
|
42
51
|
"dist/**/*",
|
|
43
52
|
"dist_*/**/*",
|
|
44
53
|
"dist_ts/**/*",
|
|
54
|
+
"dist_ts_shared/**/*",
|
|
45
55
|
"dist_ts_web/**/*",
|
|
46
56
|
"assets/**/*",
|
|
47
57
|
"cli.js",
|
|
@@ -64,9 +74,8 @@
|
|
|
64
74
|
"data analysis",
|
|
65
75
|
"file stream"
|
|
66
76
|
],
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
"buildDocs": "tsdoc"
|
|
77
|
+
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748",
|
|
78
|
+
"pnpm": {
|
|
79
|
+
"overrides": {}
|
|
71
80
|
}
|
|
72
|
-
}
|
|
81
|
+
}
|
package/readme.hints.md
CHANGED
|
@@ -1,38 +1,84 @@
|
|
|
1
1
|
# Smartarchive Development Hints
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Architecture Overview
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- **@git.zone/tsbuild**: ^2.6.6 → ^3.1.0
|
|
7
|
-
- **@git.zone/tsrun**: ^1.3.3 → ^2.0.0
|
|
8
|
-
- **@git.zone/tstest**: ^2.3.4 → ^3.1.3
|
|
9
|
-
- **@push.rocks/smartfile**: ^11.2.7 → ^13.0.0
|
|
5
|
+
`@push.rocks/smartarchive` uses a **fluent builder pattern** for all archive operations. The main entry point is `SmartArchive.create()` which returns a builder instance.
|
|
10
6
|
|
|
11
|
-
###
|
|
7
|
+
### Two Operating Modes
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
1. **Extraction Mode** - Triggered by `.url()`, `.file()`, `.stream()`, or `.buffer()`
|
|
10
|
+
2. **Creation Mode** - Triggered by `.format()` or `.entry()`
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
Modes are mutually exclusive - you cannot mix extraction and creation methods in the same chain.
|
|
13
|
+
|
|
14
|
+
## Key Classes
|
|
15
|
+
|
|
16
|
+
- **SmartArchive** - Main class with fluent API for all operations
|
|
17
|
+
- **TarTools** - TAR-specific operations (pack/extract)
|
|
18
|
+
- **ZipTools** - ZIP-specific operations using fflate
|
|
19
|
+
- **GzipTools** - GZIP compression/decompression using fflate
|
|
20
|
+
- **Bzip2Tools** - BZIP2 decompression (extract only, no creation)
|
|
21
|
+
- **ArchiveAnalyzer** - Format detection via magic bytes
|
|
22
|
+
|
|
23
|
+
## Dependencies
|
|
24
|
+
|
|
25
|
+
- **fflate** - Pure JS compression for ZIP/GZIP (works in browser)
|
|
26
|
+
- **tar-stream** - TAR archive handling
|
|
27
|
+
- **file-type** - MIME type detection via magic bytes
|
|
28
|
+
- **@push.rocks/smartfile** - SmartFile and StreamFile classes
|
|
29
|
+
|
|
30
|
+
## API Changes (v5.0.0)
|
|
31
|
+
|
|
32
|
+
The v5.0.0 release introduced a complete API refactor:
|
|
33
|
+
|
|
34
|
+
### Old API (deprecated)
|
|
35
|
+
```typescript
|
|
36
|
+
// Old static factory methods - NO LONGER EXIST
|
|
37
|
+
await SmartArchive.fromUrl(url);
|
|
38
|
+
await SmartArchive.fromFile(path);
|
|
39
|
+
await SmartArchive.fromDirectory(path, options);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### New Fluent API
|
|
43
|
+
```typescript
|
|
44
|
+
// Current fluent builder pattern
|
|
45
|
+
await SmartArchive.create()
|
|
46
|
+
.url(url)
|
|
47
|
+
.extract(targetDir);
|
|
48
|
+
|
|
49
|
+
await SmartArchive.create()
|
|
50
|
+
.format('tar.gz')
|
|
51
|
+
.directory(path)
|
|
52
|
+
.toFile(outputPath);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Migration Notes (from v4.x)
|
|
56
|
+
|
|
57
|
+
### Smartfile v13 Changes
|
|
58
|
+
Smartfile v13 removed filesystem operations. Replacements:
|
|
17
59
|
- `smartfile.fs.ensureDir(path)` → `fsPromises.mkdir(path, { recursive: true })`
|
|
18
60
|
- `smartfile.fs.stat(path)` → `fsPromises.stat(path)`
|
|
19
61
|
- `smartfile.fs.toReadStream(path)` → `fs.createReadStream(path)`
|
|
20
|
-
- `smartfile.fs.toStringSync(path)` → `fsPromises.readFile(path, 'utf8')`
|
|
21
|
-
- `smartfile.fs.listFileTree(dir, pattern)` → custom `listFileTree()` helper
|
|
22
|
-
- `smartfile.fsStream.createReadStream(path)` → `fs.createReadStream(path)`
|
|
23
|
-
- `smartfile.fsStream.createWriteStream(path)` → `fs.createWriteStream(path)`
|
|
24
|
-
- `smartfile.memory.toFs(content, path)` → `fsPromises.writeFile(path, content)`
|
|
25
62
|
|
|
26
|
-
|
|
63
|
+
### Still using from smartfile
|
|
27
64
|
- `SmartFile` class (in-memory file representation)
|
|
28
65
|
- `StreamFile` class (streaming file handling)
|
|
29
66
|
|
|
30
|
-
|
|
31
|
-
|
|
67
|
+
## Testing
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pnpm test # Run all tests
|
|
71
|
+
tstest test/test.node+deno.ts --verbose # Run specific test
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Tests use a Verdaccio registry URL (`verdaccio.lossless.digital`) for test archives.
|
|
32
75
|
|
|
33
|
-
##
|
|
76
|
+
## Key Files
|
|
34
77
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
78
|
+
- `ts/classes.smartarchive.ts` - Main SmartArchive class with fluent API
|
|
79
|
+
- `ts/classes.tartools.ts` - TAR operations
|
|
80
|
+
- `ts/classes.ziptools.ts` - ZIP operations
|
|
81
|
+
- `ts/classes.gziptools.ts` - GZIP operations
|
|
82
|
+
- `ts/classes.bzip2tools.ts` - BZIP2 decompression
|
|
83
|
+
- `ts/classes.archiveanalyzer.ts` - Format detection
|
|
84
|
+
- `ts/interfaces.ts` - Type definitions
|