Compare commits

..

4 Commits

Author SHA1 Message Date
87aedd5ef5 4.0.35 2024-06-08 14:00:56 +02:00
64431703b5 fix(core): update 2024-06-08 14:00:55 +02:00
120fd0b321 4.0.34 2024-06-08 13:47:39 +02:00
e6192c418e fix(core): update 2024-06-08 13:47:38 +02:00
3 changed files with 14 additions and 9 deletions

View File

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

View File

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

View File

@ -21,12 +21,17 @@ export class TarTools {
} }
): Promise<void> { ): Promise<void> {
return new Promise<void>(async (resolve, reject) => { return new Promise<void>(async (resolve, reject) => {
let fileName = let fileName: string | null = null;
optionsArg.fileName || optionsArg.content instanceof plugins.smartfile.SmartFile
? (optionsArg.content as plugins.smartfile.SmartFile).relative if (optionsArg.fileName) {
: null || optionsArg.content instanceof plugins.smartfile.StreamFile fileName = optionsArg.fileName;
? (optionsArg.content as plugins.smartfile.StreamFile).relativeFilePath } else if (optionsArg.content instanceof plugins.smartfile.SmartFile) {
: null || optionsArg.filePath; fileName = (optionsArg.content as plugins.smartfile.SmartFile).relative;
} else if (optionsArg.content instanceof plugins.smartfile.StreamFile) {
fileName = (optionsArg.content as plugins.smartfile.StreamFile).relativeFilePath;
} else if (optionsArg.filePath) {
fileName = optionsArg.filePath;
}
/** /**
* contentByteLength is used to set the size of the entry in the tar file * contentByteLength is used to set the size of the entry in the tar file
@ -104,7 +109,7 @@ export class TarTools {
const fileStat = await plugins.smartfile.fs.stat(absolutePath); const fileStat = await plugins.smartfile.fs.stat(absolutePath);
await this.addFileToPack(pack, { await this.addFileToPack(pack, {
byteLength: fileStat.size, byteLength: fileStat.size,
filePath: filePath, filePath: absolutePath,
fileName: filePath, fileName: filePath,
content: plugins.smartfile.fsStream.createReadStream(absolutePath), content: plugins.smartfile.fsStream.createReadStream(absolutePath),
}); });