Description Details Public fields Methods
Create a kelp fake object.
Create a kelp fake object.
Exposes same interface as kelp()
but stores files to a local temp
directory. Can be used for testing when a SeaweedFS instance
might not be available. All operations will create file ids will
return simulated data which matches structure of SeaweedFS. Uploading or
downloading files will copy to/from the temp directory.
seaweed_url
Base URL for seaweed master. Can be a dummy value.
new()
Create a mock kelp client object for testing which doesn't require a Seaweed instance to be running.
kelp_fake$new(seaweed_url)
seaweed_url
Root URL of Seaweed (can be anything for testing)
A new kelp_fake
object
upload_file()
Upload file
kelp_fake$upload_file(path, collection = NULL)
path
Path to file to be uploaded
collection
Collection name, acts as a namespace for files.
The uploaded file ID.
download_file()
Download file
If called with an id
matching an R object uploaded via
kelp$upload_object()
then this will download raw bytes which can
be converted back to R object at later point using unserialize
or readRDS
.
kelp_fake$download_file(id, path = tempfile(), collection = NULL)
id
File ID to read
path
Path to download file to
collection
Optional collection name this file belongs to.
The file contents
upload_object()
Upload arbitrary R object
This serializes R object to raw vector of bytes and then saves bytes.
kelp_fake$upload_object(object, collection = NULL)
object
Object to be uploaded
collection
Collection name, acts as a namespace.
The uploaded file ID.
download_object()
Download arbitrary R object
If data downloaded is not unserializable (i.e. it was
written using
kelp$upload_file()
) then
this will throw an error. See
kelp$download_file()
to download as a file.
kelp_fake$download_object(id, collection = NULL)
id
File ID to download
collection
Optional collection name this file belongs to.
The R object.
upload_raw()
Upload vector of raw bytes.
kelp_fake$upload_raw(raw, collection = NULL)
raw
Object to be uploaded
collection
Collection name, acts as a namespace.
The uploaded file ID.
download_raw()
Download vector of raw bytes.
kelp_fake$download_raw(id, collection = NULL)
id
File ID to download
collection
Optional collection name this file belongs to.
Vector of raw bytes.
delete()
Delete file
kelp_fake$delete(id, collection = NULL)
id
File ID to delete
collection
Optional collection name this file belongs to.
This helps speedup lookup - only the single id will be deleted.
See
kelp$delete_collection()
to remove an entire
collection.
Nothing, called for side effects
delete_collection()
Delete a collection of files
kelp_fake$delete_collection(collection)
collection
Collection name.
Nothing, called for side effects
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.