Compare commits

...

10 Commits

Author SHA1 Message Date
37e8a1d0f7 4.0.31 2024-06-08 12:44:41 +02:00
5143cd098d fix(core): update 2024-06-08 12:44:40 +02:00
4d5ea812af 4.0.30 2024-06-08 12:40:57 +02:00
500ef01ded fix(core): update 2024-06-08 12:40:56 +02:00
3196a02835 4.0.29 2024-06-08 11:06:10 +02:00
de1c46ed0a fix(core): update 2024-06-08 11:06:09 +02:00
b4c7b065fa 4.0.28 2024-06-08 11:03:38 +02:00
93da11a951 fix(core): update 2024-06-08 11:03:37 +02:00
ecd7f6d419 4.0.27 2024-06-08 11:01:56 +02:00
a3ecfe4d99 fix(core): update 2024-06-08 11:01:56 +02:00
7 changed files with 28 additions and 22 deletions

2
dist_ts/index.d.ts vendored
View File

@ -1 +1,3 @@
export * from './classes.smartarchive.js';
export * from './classes.tartools.js';
export * from './classes.ziptools.js';

View File

@ -1,2 +1,4 @@
export * from './classes.smartarchive.js';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDJCQUEyQixDQUFDIn0=
export * from './classes.tartools.js';
export * from './classes.ziptools.js';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyx1QkFBdUIsQ0FBQyJ9

View File

@ -1,6 +1,6 @@
{
"name": "@push.rocks/smartarchive",
"version": "4.0.26",
"version": "4.0.31",
"description": "A library for working with archive files, providing utilities for compressing and decompressing data.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartarchive',
version: '4.0.26',
version: '4.0.31',
description: 'A library for working with archive files, providing utilities for compressing and decompressing data.'
}

View File

@ -35,7 +35,7 @@ export class SmartArchive {
// INSTANCE
public gzipTools = new GzipTools(this);
public bzip2Tools = new Bzip2Tools(this);
public tarTools = new TarTools(this);
public tarTools = new TarTools();
public zipTools = new ZipTools(this);
public archiveAnalyzer = new ArchiveAnalyzer(this);

View File

@ -3,11 +3,7 @@ import * as plugins from './plugins.js';
export class TarTools {
// INSTANCE
smartArchiveRef: SmartArchive;
constructor(smartArchiveRefArg: SmartArchive) {
this.smartArchiveRef = smartArchiveRefArg;
}
constructor() {}
// packing
public async addFileToPack(
@ -55,6 +51,22 @@ export class TarTools {
contentByteLength = fileStat.size;
}
/**
* here we try to harmonize all kind of entries towards a readable stream
*/
let content: plugins.smartstream.stream.Readable;
if (Buffer.isBuffer(optionsArg.content)) {
content = plugins.smartstream.stream.Readable.from(optionsArg.content);
} else if (typeof optionsArg.content === 'string') {
content = plugins.smartstream.stream.Readable.from(Buffer.from(optionsArg.content));
} else if (optionsArg.content instanceof plugins.smartfile.SmartFile) {
content = plugins.smartstream.stream.Readable.from(optionsArg.content.contents);
} else if (optionsArg.content instanceof plugins.smartfile.StreamFile) {
content = await optionsArg.content.createReadStream();
} else if (optionsArg.content instanceof plugins.smartstream.stream.Readable) {
content = optionsArg.content;
}
const entry = pack.entry(
{
name: fileName,
@ -73,19 +85,6 @@ export class TarTools {
}
);
let content: plugins.smartstream.stream.Readable;
if (Buffer.isBuffer(optionsArg.content)) {
content = plugins.smartstream.stream.Readable.from(optionsArg.content);
} else if (typeof optionsArg.content === 'string') {
content = plugins.smartstream.stream.Readable.from(Buffer.from(optionsArg.content));
} else if (optionsArg.content instanceof plugins.smartfile.SmartFile) {
content = plugins.smartstream.stream.Readable.from(optionsArg.content.contents);
} else if (optionsArg.content instanceof plugins.smartfile.StreamFile) {
content = await optionsArg.content.createReadStream();
} else if (optionsArg.content instanceof plugins.smartstream.stream.Readable) {
content = optionsArg.content;
}
content.pipe(entry);
entry.on('end', () => {
resolve();
@ -110,6 +109,7 @@ export class TarTools {
content: plugins.smartfile.fsStream.createReadStream(absolutePath),
});
}
return pack;
}
public async getPackStream() {

View File

@ -1 +1,3 @@
export * from './classes.smartarchive.js';
export * from './classes.tartools.js';
export * from './classes.ziptools.js';