Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
3196a02835 | |||
de1c46ed0a | |||
b4c7b065fa | |||
93da11a951 | |||
ecd7f6d419 | |||
a3ecfe4d99 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@push.rocks/smartarchive",
|
||||
"version": "4.0.26",
|
||||
"version": "4.0.29",
|
||||
"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",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartarchive',
|
||||
version: '4.0.26',
|
||||
version: '4.0.29',
|
||||
description: 'A library for working with archive files, providing utilities for compressing and decompressing data.'
|
||||
}
|
||||
|
@ -55,6 +55,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 +89,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 +113,7 @@ export class TarTools {
|
||||
content: plugins.smartfile.fsStream.createReadStream(absolutePath),
|
||||
});
|
||||
}
|
||||
return pack;
|
||||
}
|
||||
|
||||
public async getPackStream() {
|
||||
|
@ -1 +1,3 @@
|
||||
export * from './classes.smartarchive.js';
|
||||
export * from './classes.tartools.js';
|
||||
export * from './classes.ziptools.js';
|
||||
|
Reference in New Issue
Block a user