DownloadManager

Handles resumable HTTP file downloads and archive extraction.

Supports:

  • HTTP Range-based resume for partially downloaded files.

  • Marker files (.complete) for skipping already-finished downloads.

  • ZIP archive extraction with Zip-Slip protection.

  • tar.gz extraction via external tar command with directory-traversal safety check.

  • Recursive executable search within extracted archive directories.

Parameters

log

Log function for progress and diagnostic output.

Constructors

Link copied to clipboard
constructor(log: (CodBi.LogLevel, String) -> Unit)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun downloadWithResume(url: String, targetFile: File, label: String): Boolean

Downloads a file from url to targetFile with HTTP Range resume support.

Link copied to clipboard
fun extractTarGz(tarGzFile: File, targetDir: File)

Extracts a .tar.gz archive to a target directory via external tar command.

Link copied to clipboard
fun extractZip(zipFile: File, targetDir: File)

Extracts a ZIP archive to a target directory with Zip-Slip protection.

Link copied to clipboard
fun findExecutable(dir: File, exeName: String): File?

Finds an executable file recursively within a directory, matching exeName.