(sourceDir: string, destTarball: string)
| 111 | * userland tools and does NOT include `tar` in `/usr/bin`. |
| 112 | */ |
| 113 | export async function tarDirectory(sourceDir: string, destTarball: string): Promise<void> { |
| 114 | if (!existsSync(sourceDir) || !statSync(sourceDir).isDirectory()) { |
| 115 | throw new Error(`[s3Transport] tar source must be an existing directory: ${sourceDir}`); |
| 116 | } |
| 117 | mkdirSync(dirname(destTarball), { recursive: true }); |
| 118 | await tar.create({ gzip: true, file: destTarball, cwd: sourceDir }, ["."]); |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * Extract a `.tar.gz` produced by {@link tarDirectory} into `destDir`. |
no outgoing calls
no test coverage detected