Rebol 编程/load-thru
外观
< Rebol 编程
LOAD-THRU url /update /binary /to local-file /all /expand /check info
从磁盘缓存加载网络文件。
LOAD-THRU 是一个函数值。
- url -- (类型:url 文件)
- /update -- 强制从源站点更新
- /binary -- 强制二进制模式,否则期望 REBOL 数据或代码。
- /to -- 指定本地文件目标。
- local-file -- (类型:文件 无)
- /all -- 返回包含 REBOL 脚本(包括未评估的标题)的块(安全模式)。
- /expand -- 传输后自动解压缩。
- /check -- 仅当版本、校验和/安全或日期/大小不匹配时更新。
- info -- (类型:任何)
load-thru: func [
"Load a net file from the disk cache."
url [url! file!]
/update "Force update from source site"
/binary {Force binary mode, otherwise expects REBOL data or code.}
/to "Specify local file target." local-file [file! none!]
/all {Return block with REBOL script including unevaluated header (safe mode).}
/expand "Auto-decompress after transfer."
/check {Update only if version, checksum/secure, or date/size do not match.} info
/local data
][
if not data: either update [
read-thru/update/to/expand url local-file
] [
read-thru/to/expand/check url local-file info
] [
return none
]
if binary [return load data]
if error? try [
data: either all [load/all to-string data] [load to-string data]
] [return none]
data
]