UNPKG

@ayonli/jsext

Version:

A JavaScript extension package for building strong and modern applications.

44 lines (43 loc) 1.43 kB
import { FileSystemOptions } from "../fs/types.ts"; import Tarball from "./Tarball.ts"; /** * Options for creating a tarball or loading a tarball. */ export interface TarOptions extends FileSystemOptions { /** * Compress/Decompress the archive with gzip. */ gzip?: boolean; signal?: AbortSignal; } /** * Archives the specified directory and puts it to the specified tarball file. * * NOTE: This function puts the directory itself into the archive, similar to * `tar -cf archive.tar <directory>` in Unix-like systems. * * @example * ```ts * import { tar } from "@ayonli/jsext/archive"; * * await tar("/path/to/directory", "/path/to/archive.tar"); * // with gzip * await tar("/path/to/directory", "/path/to/archive.tar.gz", { gzip: true }); * ``` */ export default function tar(src: string | FileSystemDirectoryHandle, dest: string | FileSystemFileHandle, options?: TarOptions): Promise<void>; /** * Creates a {@link Tarball} instance and puts the the specified directory into * the archive. * * NOTE: This function puts the directory itself into the archive, similar to * `tar -cf archive.tar <directory>` in Unix-like systems. * * @example * ```ts * import { tar } from "@ayonli/jsext/archive"; * * const tarball = await tar("/path/to/directory"); * ``` */ export default function tar(src: string | FileSystemDirectoryHandle, options?: FileSystemOptions): Promise<Tarball>;