@@ -50,46 +50,52 @@ export interface UnpackOptionsFS extends UnpackOptions {
5050 concurrency ?: number ;
5151}
5252
53+ /** Base interface containing common metadata properties for all source types. */
54+ export interface BaseSource {
55+ /** Destination path for the entry inside the tar archive. */
56+ target : string ;
57+ /** Optional modification time. Overrides filesystem values or defaults to current time. */
58+ mtime ?: Date ;
59+ /** Optional user ID. Overrides filesystem values or defaults to 0. */
60+ uid ?: number ;
61+ /** Optional group ID. Overrides filesystem values or defaults to 0. */
62+ gid ?: number ;
63+ /** Optional user name. */
64+ uname ?: string ;
65+ /** Optional group name. */
66+ gname ?: string ;
67+ /** Optional Unix file permissions for the entry (e.g., 0o644, 0o755). */
68+ mode ?: number ;
69+ }
70+
5371/** Describes a file on the local filesystem to be added to the archive. */
54- export interface FileSource {
72+ export interface FileSource extends BaseSource {
5573 type : "file" ;
5674 /** Path to the source file on the local filesystem. */
5775 source : string ;
58- /** Destination path for the file inside the tar archive. */
59- target : string ;
6076}
6177
6278/** Describes a directory on the local filesystem to be added to the archive. */
63- export interface DirectorySource {
79+ export interface DirectorySource extends BaseSource {
6480 type : "directory" ;
6581 /** Path to the source directory on the local filesystem. */
6682 source : string ;
67- /** Destination path for the directory inside the tar archive. */
68- target : string ;
6983}
7084
7185/** Describes raw, buffered content to be added to the archive. */
72- export interface ContentSource {
86+ export interface ContentSource extends BaseSource {
7387 type : "content" ;
7488 /** Raw content to add. Supports string, Uint8Array, ArrayBuffer, Blob, or null. */
7589 content : TarEntryData ;
76- /** Destination path for the content inside the tar archive. */
77- target : string ;
78- /** Optional Unix file permissions for the entry (e.g., 0o644). */
79- mode ?: number ;
8090}
8191
8292/** Describes a stream of content to be added to the archive. */
83- export interface StreamSource {
93+ export interface StreamSource extends BaseSource {
8494 type : "stream" ;
8595 /** A Readable or ReadableStream. */
8696 content : Readable | ReadableStream ;
87- /** Destination path for the content inside the tar archive. */
88- target : string ;
8997 /** The total size of the stream's content in bytes. This is required for streams. */
9098 size : number ;
91- /** Optional Unix file permissions for the entry (e.g., 0o644). */
92- mode ?: number ;
9399}
94100
95101/** A union of all possible source types for creating a tar archive. */
0 commit comments