X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=basis%2Fhttp%2Fdownload%2Fdownload.factor;fp=basis%2Fhttp%2Fdownload%2Fdownload.factor;h=df9fca6e593a0b9059b20c90f1deb9974c0563ec;hp=1f54064206e2a4fa32c252e22cc8d68044244e34;hb=1a083937fb43db3c978df1960d41ae257ff449aa;hpb=722d92fbfdeff55645f4148d3016798afe4fd433 diff --git a/basis/http/download/download.factor b/basis/http/download/download.factor index 1f54064206..df9fca6e59 100644 --- a/basis/http/download/download.factor +++ b/basis/http/download/download.factor @@ -1,9 +1,10 @@ ! Copyright (C) 2024 Doug Coleman. ! See https://factorcode.org/license.txt for BSD license. USING: accessors calendar checksums combinators.short-circuit -http.client io io.backend io.directories io.encodings.binary -io.files io.files.info io.files.unique io.pathnames kernel math +http.client io io.directories io.encodings.binary io.files +io.files.info io.files.unique io.pathnames kernel math math.order math.parser present sequences shuffle splitting ; + IN: http.download : file-too-old-or-not-exists? ( file duration -- ? ) @@ -87,6 +88,9 @@ PRIVATE> : download-once-to ( url file -- path ) dup file-exists? [ nip ] [ download-to ] if ; +: download-once ( url -- path ) + dup download-name download-once-to ; + : download-outdated-to ( url file duration -- path ) 2dup delete-when-old [ drop download-to ] [ drop nip ] if ;