You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(docs): jsdoc-compatible CancellablePromise typedef for NodeUtils
jsdoc cannot parse TypeScript intersection types - the
"Promise<void> & {cancel...}" return annotations broke the API docs
generator. Replaced with a CancellablePromise typedef.
Downloads a URL to a file on disk, fully node-side (native fetch, streamed to disk).
63
79
When an expected sha256 is given, a mismatch deletes the file and rejects - a resolved
64
80
promise means the file holds exactly the pinned bytes.
65
81
This is only available in the native app.
66
82
67
83
**Kind**: global function
84
+
**Returns**: [<code>CancellablePromise</code>](#CancellablePromise) - the returned promise carries a `cancel()` method that aborts
85
+
the download mid-stream - the promise then rejects with a "cancelled" error and the
86
+
partial file is deleted
68
87
69
88
| Param | Type | Description |
70
89
| --- | --- | --- |
@@ -73,35 +92,6 @@ This is only available in the native app.
73
92
|[options]| <code>Object</code> ||
74
93
|[options.sha256]| <code>string</code> | expected hex digest of the downloaded bytes |
75
94
|[options.progress]| <code>function</code> | called with (transferredBytes, totalBytes) as the download advances; totalBytes is 0 if the server sent no length |
76
-
|[options.cancelId]| <code>string</code> | registers the download so cancelDownload(cancelId) can abort it mid-stream; the partial file is deleted and the rejection error message contains "cancelled" |
0 commit comments