-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.Rmd
105 lines (75 loc) · 2.4 KB
/
README.Rmd
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{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