######################################################################
# getblob
getBlob <- function(blob, path="./",getini=FALSE,
blobpath=getOption("pgobj.blobs")) {
# options:
# blob: name of blob object
# path: if blob object is file, copy to path
# getini: if TRUE, ini file is copied too
# blobpath: directory where blobs are stored
##################################################################
# check options
if(!is.character(blob)) {
stop("blob is not character")
}
if(!is.character(path)) {
stop("path is not character")
}
if(!file.exists(path)) {
stop("path does not exist")
}
if(!is.character(blobpath)) {
stop("blobpath is not character")
}
if(!is.logical(getini)) {
stop("getini is not logical")
}
if(!is.character(blobpath)) {
stop("blobpath is not character")
}
if(!file.exists(blobpath)) {
stop("blobpath does not exist")
}
##################################################################
# get blob
# get blob object, getObj returns error if blob does not exist
blob.obj <- getObj(blob);
# get blobfile
blobfile <- paste(blobpath,blob.obj$fname,sep='/')
if(!file.exists(blobfile)) {
stop(paste("blob",blobfile,"not found"))
}
file.copy(blobfile,path,overwrite=TRUE)
if(getini) {
inifile <- paste(blobfile,".ini",sep='')
file.copy(inifile,path,overwrite=TRUE)
}
# check md5
fpath <- paste(path,blob.obj$fname,sep='/')
checkmd5(fpath,blob.obj)
# return blob.obj
return(blob.obj)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.