Rebol 程式設計/load-thru
外觀
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
]