[not loaded]![Click to show exports only All predicates](/swish/pldoc/res/private.png)
download.pl -- Provide a button for downloading data
This module allows a button to be inserted into the Pengine output that
allows for downloading data. Originally this used the data
type URL.
This has been disabled in recent browsers. Also considering the length
limitations on URLs on some browsers we now store the data server-side
and make the link simply download the data. The data is kept on the
server for keep_downloads_time
seconds, default 24 hours.
download_button(+Data:string, +Options)
- Emit a button in the SWISH output window for downloading Data.
The provided data is stored on the server.
Options:
- filename(+Name)
- (Base-)Name of the file created (default:
swish-download.dat
), - content_type(+Type)
- Full content type. By default this is derived from the extension of the filename and the encoding.
- encoding(+Enc)
- Encoding to use. One of
utf8
oroctet
. default isutf8
.
download(+Request)[private]
- Handle a download request.
save_download_data(+Data, -UUID, +Encoding) is det[private]
- Save the string Data in the download store and return a UUID to retreive it.
download_file(?UUID, -Path)[private]
- Path is the full file from which to download Name.
download_dir(-Dir) is det[private]
- Find the download base directory.
prune_downloads[private]
- Prune old download files. This is actually executed every 1/4th of the time we keep the files. This makes this call fast.
prune_dir(+Dir, +Time, +PruneDir) is det[private]
- Find all files older than Time and delete them as well as empty directories.
clean_entry(+Dir, +Time, +File) is semidet[private]
- True when Dir/File has been cleaned and is removed.