File: readCacheHeader.R

package info (click to toggle)
r-cran-r.cache 0.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 392 kB
  • sloc: sh: 14; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 553 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library("R.cache")

## Use an empty temporary file cache
setCacheRootPath(path=file.path(tempdir()))

dirs <- c("tests", "readCacheHeader")

for (compress in c(FALSE, TRUE)) {
  pathname <- saveCache(1, key=list("readCacheHeader"), dirs=dirs, compress=compress)

  for (byName in c(FALSE, TRUE)) {
    if (byName) {
      hdr <- readCacheHeader(pathname)
    } else {
      con <- gzfile(pathname, open="rb")
      hdr <- readCacheHeader(con)
      close(con)
    }
    str(list(pathname=pathname, hdr=hdr))
  }
}

## Cleanup
clearCache(recursive=TRUE)