l0.DependencyControl.shims.DownloadManager¶
DownloadManager ¶
A download manager replicating the DM.DownloadManager API on top of the DependencyControl Downloader engine.
Constructor ¶
Creates a download manager.
| param | type | description |
|---|---|---|
| etagCacheDir? | string |
Accepted for API compatibility; ETag caching is not implemented. |
Instance methods¶
addDownload ¶
Queues a download, optionally verifying its SHA-1 once complete.
| param | type | description |
|---|---|---|
| url | string |
|
| outfile | string |
Full output path. |
| sha1? | string |
Expected SHA-1 hash. |
| etag? | string |
Accepted for API compatibility; ignored. |
Returns:
downloadDownload?errstring?
waitForFinish ¶
Performs all queued downloads (DM.DownloadManager-compatible).
| param | type | description |
|---|---|---|
| callback? | fun(progress: number): any |
Called with 0-100; returning a falsy value cancels remaining downloads. Bridged to the engine's Progress event. |
progress ¶
Returns:
progressnumber— Current aggregate progress (0-100).
cancel ¶
Cancels all remaining queued downloads.
clear ¶
Removes all queued downloads and resets state; existing .downloads references stay valid.
isInternetConnected ¶
Returns:
connectedboolean— Whether an internet connection appears to be available.
getFileSHA1 ¶
Computes the SHA-1 of a file's contents.
| param | type | description |
|---|---|---|
| filename | string |
Returns:
hexDigeststring?errstring?
checkFileSHA1 ¶
Verifies a file against an expected SHA-1 hash.
| param | type | description |
|---|---|---|
| filename | string |
|
| expected | string |
Expected SHA-1 hex digest. |
Returns:
matchboolean?errstring?
checkStringSHA1 ¶
Verifies a string against an expected SHA-1 hash.
| param | type | description |
|---|---|---|
| str | string |
|
| expected | string |
Expected SHA-1 hex digest. |
Returns:
matchboolean?errstring?
Fields¶
| field | type | description |
|---|---|---|
| version | string |