Package 'fstorr'

Title: File Storage
Description: Store files by content, similar in spirit to the 'storr' package (into which this might get folded).
Authors: Rich FitzJohn [aut, cre], Imperial College of Science, Technology and Medicine [cph]
Maintainer: Rich FitzJohn <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-06-11 09:52:35 UTC
Source: https://github.com/reside-ic/fstorr

Help Index


Create an fstorr object

Description

Create an fstorr object - a place to store data by content based on a global key.

Usage

fstorr(root, get_resource, hash_content = NULL)

Arguments

root

Root to store files in - a path to a directory. If it exists it must be a directory and you should treat the contents as opaque.

get_resource

A function that gets a resource. It must take as its argument a key, and it must return a raw vector (character vectors are not supported on return because they are complicated for thinking about line-endings and hashes).

hash_content

A function that hashes a resource. If not given then openssl::sha256 will be used. If providing your own it must take a filename as an argument and return a character string corresponding to a hash. It is very important that the same mapping function here is used for all creations of an fstorr object!

Value

A fstorr object

Author(s)

Rich Fitzjohn

Examples

path <- tempfile()
obj <- fstorr::fstorr(path, charToRaw)
obj$list()
obj$get("a")