The trivial-download Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The trivial-download Reference Manual

This is the trivial-download Reference Manual, version 0.3, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 09:26:38 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

trivial-download

Build Status Coverage Status Quicklisp

trivial-download allows you to download files from the Internet from Common Lisp. It even provides a progress bar.

Usage

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.

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.

Downloads the contents of url, executing body in every chunk.

The extra arguments are:

Example:

(with-download "https://github.com/favicon.ico"
  ;; Do something
  )

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.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 trivial-download

Maintainer

Fernando Borretti <eudoxiahp@gmail.com>

Author

Fernando Borretti <eudoxiahp@gmail.com>

Home Page

https://github.com/eudoxia0/trivial-download

Source Control

(:git "git@github.com:eudoxia0/trivial-download.git")

Bug Tracker

https://github.com/eudoxia0/trivial-download/issues

License

MIT

Description

Download files from Common Lisp

Long Description

# 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.

Version

0.3

Dependency

drakma

Source

trivial-download.asd (file)

Component

src (module)


Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 trivial-download/src

Parent

trivial-download (system)

Location

src/

Component

trivial-download.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 trivial-download.asd

Location

trivial-download.asd

Systems

trivial-download (system)


Previous: , Up: Lisp files   [Contents][Index]

4.1.2 trivial-download/src/trivial-download.lisp

Parent

src (module)

Location

src/trivial-download.lisp

Packages

trivial-download

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

5.1 trivial-download

Source

trivial-download.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Special variables

Special Variable: *chunk-size*

Files are downloaded in chunks of this many bytes.

Package

trivial-download

Source

trivial-download.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Macros

Macro: with-download URL (FILE-SIZE TOTAL-BYTES-READ ARRAY STREAM &key QUIET) &body BODY

Execute body at every chunk that is downloaded.

Package

trivial-download

Source

trivial-download.lisp (file)

Macro: with-download-progress URL (FILE-SIZE TOTAL-BYTES-READ ARRAY STREAM &key QUIET) &body BODY

Like with-download but with a progress bar.

Package

trivial-download

Source

trivial-download.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.3 Functions

Function: download URL OUTPUT &key QUIET

Download a file and save it to a pathname. Directories containing ‘output‘ are created if they don’t exist.

Package

trivial-download

Source

trivial-download.lisp (file)

Function: file-size URL

Take a URL to a file, return the size (in bytes).

Package

trivial-download

Source

trivial-download.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.4 Conditions

Condition: http-error ()
Package

trivial-download

Source

trivial-download.lisp (file)

Direct superclasses

error (condition)

Direct methods
Direct slots
Slot: code
Initargs

:code

Readers

response-code (generic function)

Writers

(setf response-code) (generic function)


Previous: , Up: Definitions   [Contents][Index]

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Special variables

Special Variable: +size-symbol-map+
Package

trivial-download

Source

trivial-download.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Functions

Function: http-request URL &rest ARGS
Package

trivial-download

Source

trivial-download.lisp (file)

Function: human-file-size SIZE

Take a file size (in bytes), return it as a human-readable string.

Package

trivial-download

Source

trivial-download.lisp (file)

Function: percentage TOTAL-BYTES CURRENT-BYTES
Package

trivial-download

Source

trivial-download.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.3 Generic functions

Generic Function: response-code CONDITION
Generic Function: (setf response-code) NEW-VALUE CONDITION
Package

trivial-download

Methods
Method: response-code (CONDITION http-error)
Method: (setf response-code) NEW-VALUE (CONDITION http-error)
Source

trivial-download.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   M   T  
Index Entry  Section

F
File, Lisp, trivial-download.asd: The trivial-download<dot>asd file
File, Lisp, trivial-download/src/trivial-download.lisp: The trivial-download/src/trivial-download<dot>lisp file

L
Lisp File, trivial-download.asd: The trivial-download<dot>asd file
Lisp File, trivial-download/src/trivial-download.lisp: The trivial-download/src/trivial-download<dot>lisp file

M
Module, trivial-download/src: The trivial-download/src module

T
trivial-download.asd: The trivial-download<dot>asd file
trivial-download/src: The trivial-download/src module
trivial-download/src/trivial-download.lisp: The trivial-download/src/trivial-download<dot>lisp file

Jump to:   F   L   M   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
D   F   G   H   M   P   R   W  
Index Entry  Section

(
(setf response-code): Internal generic functions
(setf response-code): Internal generic functions

D
download: Exported functions

F
file-size: Exported functions
Function, download: Exported functions
Function, file-size: Exported functions
Function, http-request: Internal functions
Function, human-file-size: Internal functions
Function, percentage: Internal functions

G
Generic Function, (setf response-code): Internal generic functions
Generic Function, response-code: Internal generic functions

H
http-request: Internal functions
human-file-size: Internal functions

M
Macro, with-download: Exported macros
Macro, with-download-progress: Exported macros
Method, (setf response-code): Internal generic functions
Method, response-code: Internal generic functions

P
percentage: Internal functions

R
response-code: Internal generic functions
response-code: Internal generic functions

W
with-download: Exported macros
with-download-progress: Exported macros

Jump to:   (  
D   F   G   H   M   P   R   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *   +  
C   S  
Index Entry  Section

*
*chunk-size*: Exported special variables

+
+size-symbol-map+: Internal special variables

C
code: Exported conditions

S
Slot, code: Exported conditions
Special Variable, *chunk-size*: Exported special variables
Special Variable, +size-symbol-map+: Internal special variables

Jump to:   *   +  
C   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   H   P   S   T  
Index Entry  Section

C
Condition, http-error: Exported conditions

H
http-error: Exported conditions

P
Package, trivial-download: The trivial-download package

S
System, trivial-download: The trivial-download system

T
trivial-download: The trivial-download system
trivial-download: The trivial-download package

Jump to:   C   H   P   S   T