R6 class implementing fast random access to zip files.

R6 class implementing fast random access to zip files.

Public fields

zipfile

the path to the zip file

Methods

Public methods


Method new()

Initialise an RAZip object

Usage

RAZip$new(zipfile, unserialize = NULL)

Arguments

zipfile

path to the zip file

unserialize

Optional function to be applied to raw bytes from the zip file. When missing R's unserialize or qs::deserialize is used.


Method getbytes()

read raw bytes for a zip entry

Usage

RAZip$getbytes(f)

Arguments

f

A file inside the zip to read.


Method get()

read an R object from a zip entry

Usage

RAZip$get(f)

Arguments

f

A file inside the zip to read.


Method mget()

read multiple R objects from a zip file

Usage

RAZip$mget(f, ...)

Arguments

f

One or more files inside the zip to read

...

additional arguments passed to pbapply::pbsapply

Returns

A named list


Method ziplist()

Return the zip info from zip::zip_list

Usage

RAZip$ziplist()

Returns

A named list


Method clone()

The objects of this class are cloneable with this method.

Usage

RAZip$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# \donttest{ smp=RAZip$new(system.file("sampledata/Cell07PNs-rds.zip", package = 'razip')) smp
#> RAZip object wrapping: /Users/runner/work/_temp/Library/razip/sampledata/Cell07PNs-rds.zip which contains 5 files.
# } if (FALSE) { raz=RAZip$new("~/Desktop/flywire_neurons_flow_FlyWireqs.zip") raz zl=raz$ziplist() bench::mark(s1=raz$get(sample(zl$filename, 1)), check = F) }