downloadObject: Download an object from the DataONE Federation to Disk.

Description Usage Arguments Details Value See Also Examples

Description

A convenience method to download an object to disk.

Usage

1
2
3
4
5
downloadObject(x, identifier, ...)

## S4 method for signature 'D1Client'
downloadObject(x, identifier, path = getwd(),
  check = as.logical(TRUE))

Arguments

x

A D1Client object.

identifier

The identifier of the object to get.

...

(Not yet used.)

path

(optional) Path to a directory to write object to. The name of the file will be determined from the SystemMetada of the object (see details for more information). The function will fail if a file with the same name already exists in the directory.

check

(optional) A logical value, if TRUE check if this object has been obsoleted by another object in DataONE.

Details

This method performs multiple underlying calls to the DataONE repository network. CN.resolve() is called to locate the object on one or more repositories, and then each of these is accessed until success at downloading the associated SystemMetadata for the object. The SystemMetadata is used to assign a name to the file that is output to disk. If a fileName is specified in the SystemMetadata, then the file output to disk will be named according to the SystemMetadata fileName. If there is not a specified SystemMetadata fileName, the identifier will be used as the file name output to disk. If the indentifier is used as the file name, a file name extesion will be determined using the SystemMetadata formatID along with information from CNCore.listFormats(). If the SystemMetadata formatID is "application/octet-stream" no extension will be written.

Value

A path where the ouput file is written to.

See Also

D1Client class description.

Examples

1
2
3
4
5
6
7
## Not run: 
library(dataone)
d1c <- D1Client("PROD", "urn:node:KNB")
pid <- "solson.5.1"
path <- downloadObject(d1c, pid)

## End(Not run)

dataone documentation built on July 2, 2018, 1:02 a.m.