Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the trivial-download Reference Manual, version 0.3, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 15:18:30 2020 GMT+0.
• Introduction | What trivial-download is all about | |
• Systems | The systems documentation | |
• Modules | The modules documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
trivial-download allows you to download files from the Internet from Common Lisp. It even provides a progress bar.
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
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.
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.
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:
(with-download "https://github.com/favicon.ico"
;; Do something
)
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.
Copyright (c) 2014-2015 Fernando Borretti (eudoxiahp@gmail.com)
Licensed under the MIT License.
Next: Modules, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The trivial-download system |
Fernando Borretti <eudoxiahp@gmail.com>
Fernando Borretti <eudoxiahp@gmail.com>
(:git "git@github.com:eudoxia0/trivial-download.git")
MIT
Download files from Common Lisp
# trivial-download
[](https://travis-ci.org/eudoxia0/trivial-download)
[](https://coveralls.io/r/eudoxia0/trivial-download?branch=master)
[](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
trivial-download.asd (file)
src (module)
Modules are listed depth-first from the system components tree.
• The trivial-download/src module |
trivial-download (system)
src/
trivial-download.lisp (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The trivial-download.asd file | ||
• The trivial-download/src/trivial-download.lisp file |
Next: The trivial-download/src/trivial-download․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
trivial-download.asd
trivial-download (system)
Previous: The trivial-download․asd file, Up: Lisp files [Contents][Index]
src (module)
src/trivial-download.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The trivial-download package |
trivial-download.lisp (file)
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables | ||
• Exported macros | ||
• Exported functions | ||
• Exported conditions |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
Files are downloaded in chunks of this many bytes.
trivial-download.lisp (file)
Next: Exported functions, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
Execute body at every chunk that is downloaded.
trivial-download.lisp (file)
Like with-download but with a progress bar.
trivial-download.lisp (file)
Next: Exported conditions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
Download a file and save it to a pathname. Directories containing ‘output‘ are created if they don’t exist.
trivial-download.lisp (file)
Take a URL to a file, return the size (in bytes).
trivial-download.lisp (file)
Previous: Exported functions, Up: Exported definitions [Contents][Index]
trivial-download.lisp (file)
error (condition)
:code
response-code (generic function)
(setf response-code) (generic function)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables | ||
• Internal functions | ||
• Internal generic functions |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
trivial-download.lisp (file)
Next: Internal generic functions, Previous: Internal special variables, Up: Internal definitions [Contents][Index]
trivial-download.lisp (file)
Take a file size (in bytes), return it as a human-readable string.
trivial-download.lisp (file)
trivial-download.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
trivial-download.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L M T |
---|
Jump to: | F L M T |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
D F G H M P R W |
---|
Jump to: | (
D F G H M P R W |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
+
C S |
---|
Jump to: | *
+
C S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C H P S T |
---|
Jump to: | C H P S T |
---|