Rebol Programming/info?

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:[edit | edit source]

INFO? target 

DESCRIPTION:[edit | edit source]

Returns information about a file or url.

INFO? is a function value.

ARGUMENTS:[edit | edit source]

  • target -- (Type: file url)

(SPECIAL ATTRIBUTES)[edit | edit source]

  • catch

SOURCE CODE[edit | edit source]

info?: func [
    "Returns information about a file or url." 
    [catch] 
    target [file! url!]
][
    throw-on-error [
        target: make port! target 
        query target
    ] 
    either none? target/status [
        none
    ] [
        make object! [
            size: target/size date: target/date type: target/status
        ]
    ]
]