Module downloads
Downloads for luakit
This module adds support for downloading files from websites, and provides a Lua API to monitor and control the file download process.
Enabling this module is sufficient for starting downloads, but users will
probably wish to also enable the downloads_chrome
module.
Functions
downloads.init ()
Connect to and initialize the downloads database.
downloads.get_all ()
Get all download objects.
Return Values
-
tableThe table of all download objects.
downloads.to_download (id)
Get download object from ID (passthrough if already given download object).
Parameters
-
idType: download or numberThe download object or the ID of a download object.
Return Values
-
downloadThe download object.
-
tableThe download object's private data.
downloads.get (id)
Get private data for a download object.
Parameters
-
idType: download or numberThe download object or the ID of a download object.
downloads.do_open (d, w)
Attempt to open a downloaded file.
Parameters
-
dType: downloadThe download object.
-
wType: tableThe current window table.
downloads.add (uri, opts)
Add a new download.
Parameters
-
uriType: stringThe URI to download.
-
optsType: tableA table of options.
downloads.cancel (id)
Cancel a download.
Parameters
-
idType: download or numberThe download object or the ID of a download object.
downloads.remove (id)
Remove a download. If the download is running, it will be cancelled.
Parameters
-
idType: download or numberThe download object or the ID of a download object.
downloads.restart (id)
Restart a download.
A new download with the same source URI as id
is created, and the original
download id
is removed.
Parameters
-
idType: download or numberThe download object or the ID of a download object.
Return Values
-
downloadThe download object.
downloads.open (id, w)
Attempt to open a downloaded file, as soon as the download completes.
If the download is already completed, this is equivalent to do_open()
.
Parameters
-
idType: download or numberThe download object or the ID of a download object.
-
wType: tableThe current window table.
downloads.clear ()
Clear all finished, cancelled or aborted downloads.
Properties
downloads.db_path
downloads.default_dir
Attribution
Copyright
- 2010–2012 Mason Larobina
- 2010 Fabian Streitel