]> gitweb.factorcode.org Git - factor.git/blob - basis/http/download/download-docs.factor
scryfall: better moxfield words
[factor.git] / basis / http / download / download-docs.factor
1 ! Copyright (C) 2024 Doug Coleman.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: calendar help.markup help.syntax io.pathnames kernel math
4 strings urls ;
5 IN: http.download
6
7 HELP: download
8 { $values { "url" { $or url string } } { "path" "a pathname string" } }
9 { $description "Downloads the contents of the URL to a file in the " { $link current-directory } " having the same file name and returns the pathname." }
10 { $notes "Use this to download the file every time." }
11 { $errors "Throws an error if the HTTP request fails." } ;
12
13 HELP: download-to
14 { $values { "url" { $or url string } } { "path" "a pathname string" } }
15 { $description "Downloads the contents of the URL to a file with the given pathname and returns the pathname." }
16 { $notes "Use this to download the file every time." }
17 { $errors "Throws an error if the HTTP request fails." } ;
18
19 HELP: download-once-to
20 { $values { "url" { $or url string } } { "path" "a pathname string" } }
21 { $description "If the file exists on disk, returns that pathname without downloading anything. Otherwise, downloads the contents of the URL to a file with the given pathname and returns the pathname." }
22 { $notes "Use this if the contents of the URL are not expected to change." }
23 { $errors "Throws an error if the HTTP request fails." } ;
24
25
26 ARTICLE: "http.download" "HTTP Download Utilities"
27 "The " { $vocab-link "http.download" } " vocabulary provides utilities for downloading files from the web."
28
29 "Utilities to retrieve a " { $link url } " and save the contents to a file:"
30 { $subsections
31     download
32     download-to
33     download-once-to
34 }
35 ;
36
37 ABOUT: "http.download"