Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ropensci/hoardr

Manage cached files
https://github.com/ropensci/hoardr

caching r r-package rstats

Last synced: 3 months ago
JSON representation

Manage cached files

Awesome Lists containing this project

README

        

---
output: github_document
editor_options:
chunk_output_type: console
---

```{r echo=FALSE}
knitr::opts_chunk$set(
warning = FALSE,
message = FALSE,
collapse = TRUE,
comment = "#>"
)
```
# hoardr

[![status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![cran checks](https://badges.cranchecks.info/worst/hoardr.svg)](https://badges.cranchecks.info/worst/hoardr.svg)
[![R-check](https://github.com/ropensci/hoardr/workflows/R-check/badge.svg)](https://github.com/ropensci/hoardr/actions?query=workflow%3AR-check)
[![codecov.io](https://codecov.io/github/ropensci/hoardr/coverage.svg?branch=master)](https://app.codecov.io/github/ropensci/hoardr?branch=master)
[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/hoardr)](https://cran.r-project.org/package=hoardr)
[![cran version](https://www.r-pkg.org/badges/version/hoardr)](https://cran.r-project.org/package=hoardr)

`hoard` - manage cached files

Exposes a single `R6` object so that when the package is imported in another
package for managing cached files, you don't need to pollute the NAMESPACE
with a bunch of functions. (you can always just `hoardr::fxn`, but
with a single object there are other benefits as well [maintaining state, e.g.]).

## install

stable

```{r eval=FALSE}
install.packages("hoardr")
```

dev version

```{r eval=FALSE}
remotes::install_github("ropensci/hoardr")
```

```{r}
library(hoardr)
```

## usage

initialize client

```{r}
(x <- hoardr::hoard())
```

set cache path

```{r}
x$cache_path_set("foobar", type = 'tempdir')
```

make the directory if doesn't exist

```{r}
x$mkdir()
```

put a file in the cache

```{r}
cat("hello world", file = file.path(x$cache_path_get(), "foo.txt"))
```

list the files

```{r}
x$list()
```

details

```{r}
x$details()
```

delete by file name

```{r}
x$delete("foo.txt")
x$list()
```

## Meta

* Please [report any issues or bugs](https://github.com/ropensci/hoardr/issues).
* License: MIT
* Get citation information for `hoardr` in R doing `citation(package = 'hoardr')`
* Please note that this project is released with a [Contributor Code of Conduct][coc]. By participating in this project you agree to abide by its terms.

[![rofooter](https://ropensci.org/public_images/github_footer.png)](https://ropensci.org)

[coc]: https://github.com/ropensci/hoardr/blob/master/CODE_OF_CONDUCT.md