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.get_all ()

Get all download objects.

Return Values

  • table
    The table of all download objects.

downloads.to_download (id)

Get download object from ID (passthrough if already given download object).

Parameters

  • id
    Type: download or number
    The download object or the ID of a download object.

Return Values

  • download
    The download object.
  • table
    The download object's private data.

downloads.get (id)

Get private data for a download object.

Parameters

  • id
    Type: download or number
    The download object or the ID of a download object.

downloads.do_open (d, w)

Attempt to open a downloaded file.

Parameters

  • d
    Type: download
    The download object.
  • w
    Type: table
    The current window table.

downloads.add (uri, opts)

Add a new download.

Parameters

  • uri
    Type: string
    The URI to download.
  • opts
    Type: table
    A table of options.

downloads.cancel (id)

Cancel a download.

Parameters

  • id
    Type: download or number
    The 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

  • id
    Type: download or number
    The 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

  • id
    Type: download or number
    The download object or the ID of a download object.

Return Values

  • download
    The 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

  • id
    Type: download or number
    The download object or the ID of a download object.
  • w
    Type: table
    The current window table.

downloads.clear ()

Clear all finished, cancelled or aborted downloads.

Properties

downloads.default_dir

Type: string
Read-write
Default download directory.

Attribution

Copyright