Description Usage Arguments Details Value See Also Examples
Transfers file, buffer to Manta Storage Object specified in
mantapath. To save a file, specify the filename. It will go
into the current working Manta directory with the same name
unless absolute Manta path or relative object name is
specified with the mantapath
argument. To see the
current directory on Manta use mantaGetwd
,
and mantaSetwd
to change it.
1 2 |
mantapath |
character, optional. Path to where
uploaded data will go on Manta or Manta Object file name
in current working Manta directory. If |
filename |
vector of character, optional. Path to
local file to upload. If only a filename is given,
assumes file is in path specified by |
buffer |
optional. Raw buffer of data to put. If filename is specified, buffer is ignored and filename contents are uploaded. Not vectorized. |
md5 |
logical optional. Test md5 hash of file/raw
buffer with OpenSSL before/after upload. |
headers |
optional. Headers including R structured
metadata (up to 4k in user metadata) as array of named
character E.g. |
info |
logical required. |
verbose |
logical, optional. Passed to |
To save a raw R buffer, pass the string with its name e.g. buffer = "myRawBuffer"
One limitation of the mantaRSDK
is that it is not
designed to handle large (multi-Gigabyte or larger)
objects. Uploads - mantaPut
- work from files, but
Downloads - mantaGet
- fill the R memory
space to their completion before being written to a file.
To download files larger than your R memory, use the Manta
Node.js command line tool mget
. The Node.js based
Manta command line tools employ streams, so object size is
not a limitation.
The Content-Type information metatdata for the file is
obtained using the RCurl library function
guessMIMEtype
on the filename extension provided,
e.g. .jpg
or it can be set by passing a
header
parameter, which is an RCurl
style
HTTP header - a list of named character values like
this:
header = c('content-type' = "image/jpg")
.
The default Content-Type
header is
"application/octet-stream"
. The number of copies
(durability level) saved is by default 2. This can be
changed by using headers like this:
headers =
c('x-durability-level' = 4)
for one-time use.
For
larger operations use mantaSetLimits
to
change the default durability level for the current
mantaRSDK session. The number of copies stored can range
from 2 to 6. This function does not support streaming
uploads, for that use the Node.js Manta command line
interface (CLI). Other Manta operations involving HTTP
conditional request semantics and CORS headers are not
implemented in this R library, but can be used with the
Node.js CLI which can be called from R with the
system2
command shell. mantaPut
is a wrapper
for mantaXfer
, which implements the actual
RCURL
data upload.
TRUE
or FALSE
depending on success of upload.
Other mantaPut: mantaDump
;
mantaSave.image
; mantaSave.ws
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ## Not run:
## Save a static hello world HTML page
htmlpage <- paste("<!DOCTYPE html>\n<html>\n<body>\n\n",
"<h1>Hello from Joyent Manta.</h1>\n\n",
"<p>Hello world! from ",
mantaWhoami(),
".</p>\n\n",
"</body>\n</html>", sep="")
file <- file("test_index.html", "wb")
write(htmlpage,file)
close(file)
rm(file)
rm(htmlpage)
## Upload the HTML file to Manta in your public area
mantaSetwd.public()
mantaPut("test_index.html")
mantaExists("test_index.html")
mantaCat("test_index.html")
ls()
buffer <- mantaGet("test_index.html", buffer = TRUE)
cat(rawToChar(buffer))
## Upload the raw buffer
mantaPut(mantapath = "~~/public/buffer_index.html", buffer = buffer)
mantaLs.l(grepfor = "[.]html")
mantaCat("buffer_index.html")
## Check file metadata to see Content-type
mantaGet("test_index.html", metadata = TRUE)
mantaGet("buffer_index.html", metadata = TRUE)
## copy and paste URL into browser.
mantaLs.url("~~/public", grepfor = "[.]html")
## Cleanup this demo
#mantaRm("~~/public/test_index.html")
#mantaRm("~~/public/buffer_index.html")
#file.remove("test_index.html")
#rm(buffer)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.