Module dist.fetch

This module is responsible for downloading contents using URIs. It should handle at least HTTP and FILE URIs as well as system paths transparently. 2DO: support for more protocols if demanded. Two functions are provided. Notice that http requests are cached. download - To download dists. get - To directly obtain manifests.

Functions

download (src, dest) Fetch file from URI into destination.
get (src) Directly get file contents from URI using luasocket.


Functions

download (src, dest)
Fetch file from URI into destination.

Parameters

  • src: string: URI to fetch file from. Accepts paths too.
  • dest: string: Destination dir, if not provided temporary dir will be used.

Return value:

path, log: Path the file was downloaded and the resulting log message.
get (src)
Directly get file contents from URI using luasocket.

Parameters

  • src: string: URI to fetch file from. Accepts paths too.

Return value:

text, log: Contents of the URL file or nil and log message.

Valid XHTML 1.0!