This is the trivial-download Reference Manual, version 0.3, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 06:56:25 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
trivial-download
Download files from Common Lisp
Fernando Borretti <eudoxiahp@gmail.com>
Fernando Borretti <eudoxiahp@gmail.com>
(GIT git@github.com:eudoxia0/trivial-download.git)
MIT
# trivial-download
[![Build Status](https://travis-ci.org/eudoxia0/trivial-download.svg?branch=master)](https://travis-ci.org/eudoxia0/trivial-download)
[![Coverage Status](https://coveralls.io/repos/eudoxia0/trivial-download/badge.svg?branch=master)](https://coveralls.io/r/eudoxia0/trivial-download?branch=master)
[![Quicklisp](http://quickdocs.org/badge/trivial-download.svg)](http://quickdocs.org/trivial-download/)
trivial-download allows you to download files from the Internet from Common
Lisp. It even provides a progress bar.
# Usage
“‘lisp
cl-user> (download "http://www.google.com/robots.txt" "/tmp/robots.txt")
Downloading "http://www.google.com/robots.txt" (Unknown size)
t
cl-user> (download "https://github.com/favicon.ico" "/tmp/favicon.ico")
Downloading "https://github.com/favicon.ico" (6.518 kB)
.........10%.........20%.........30%.........40%.........50%.........60%.........70%.........80%.........90%.........100%t
“‘
# Documentation
You probably want the ‘download‘ function, which downloads files from the
network to the local disk. If you want more control over that – like, say,
writing the downloaded bytes to a database instead – you want the
‘with-download‘ macro.
‘trivial-download‘ downloads everything in chunks that are ‘*chunk-size*‘ bytes
long. ‘*chunk-size*‘, by default, is 256.
* [Function] ‘download‘ *(url output)*
Downloads the content of ‘url‘ and writes it to ‘output‘. The file is written as
it is downloaded, chunk-by-chunk, not downloaded into memory and written at
once.
* [Macro] ‘with-download‘ *(url (file-size total-bytes-read array stream) &rest body)*
Downloads the contents of ‘url‘, executing ‘body‘ in every chunk.
The extra arguments are:
- ‘stream‘: A ‘flexi-io-stream‘ bivalent stream.
- ‘file-size‘: The size, in bytes, of the file to download.
- ‘bytes-read‘: The number of bytes read.
- ‘array‘: As every chunk is downloaded, its contents are written to ‘array‘.
Example:
“‘lisp
(with-download "https://github.com/favicon.ico"
;; Do something
)
“‘
* [Macro] ‘with-download-progress‘ *(url (file-size total-bytes-read array stream) &rest body)*
The same as ‘with-download‘, only this prints progress information while
downloading.
# License
Copyright (c) 2014-2015 Fernando Borretti (eudoxiahp@gmail.com)
Licensed under the MIT License.
0.3
drakma
(system).
src
(module).
Modules are listed depth-first from the system components tree.
trivial-download/src
trivial-download
(system).
trivial-download.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
trivial-download/trivial-download.asd
trivial-download
(system).
trivial-download/src/trivial-download.lisp
src
(module).
*chunk-size*
(special variable).
download
(function).
file-size
(function).
http-error
(condition).
with-download
(macro).
with-download-progress
(macro).
+size-symbol-map+
(special variable).
http-request
(function).
human-file-size
(function).
percentage
(function).
response-code
(reader method).
(setf response-code)
(writer method).
Packages are listed by definition order.
trivial-download
common-lisp
.
*chunk-size*
(special variable).
download
(function).
file-size
(function).
http-error
(condition).
with-download
(macro).
with-download-progress
(macro).
+size-symbol-map+
(special variable).
http-request
(function).
human-file-size
(function).
percentage
(function).
response-code
(generic reader).
(setf response-code)
(generic writer).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Files are downloaded in chunks of this many bytes.
Execute body at every chunk that is downloaded.
Like with-download but with a progress bar.
Download a file and save it to a pathname. Directories containing ‘output‘ are created if they don’t exist.
Take the headers of a http request, return the size (in bytes).
Take a file size (in bytes), return it as a human-readable string.
http-error
)) ¶http-error
)) ¶code
.
Jump to: | (
D F G H M P R W |
---|
Jump to: | (
D F G H M P R W |
---|
Jump to: | *
+
C S |
---|
Jump to: | *
+
C S |
---|
Jump to: | C F H M P S T |
---|
Jump to: | C F H M P S T |
---|