Last modified on 31 October 2012, at 12:44

REBOL Programming/load-thru

USAGE:Edit

LOAD-THRU url /update /binary /to local-file /all /expand /check info 

DESCRIPTION:Edit

Load a net file from the disk cache.

LOAD-THRU is a function value.

ARGUMENTS:Edit

  • url -- (Type: url file)

REFINEMENTS:Edit

  • /update -- Force update from source site
  • /binary -- Force binary mode, otherwise expects REBOL data or code.
  • /to -- Specify local file target.
    • local-file -- (Type: 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 -- (Type: any)

SOURCE CODEEdit

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
]