DownloadProgress
The progress of the download.
import { DownloadProgress } from '@mobrowser/api';
Example
import { app, DownloadProgress } from '@mobrowser/api';
const win = app.createWindow()
win.browser.handle('startDownload', async ({ download }) => {
download.on('progressChanged', (progress: DownloadProgress) => {
console.log(
`${progress.receivedBytes}/${progress.totalBytes} ` +
`(${progress.percentComplete}%)`
)
})
return 'prompt'
})
win.browser.downloadUrl('https://example.com/file.zip')
Properties
currentSpeed
readonly currentSpeed: number;
The current speed of the download in bytes per second.
totalBytes
readonly totalBytes: number;
The total size of the download in bytes.
receivedBytes
readonly receivedBytes: number;
The number of bytes received so far in bytes.
percentComplete
readonly percentComplete: number;
The rough percent complete.
-1 if progress is unknown. 100 if the download is already complete.