class Asar::Extract
- Asar::Extract
- Reference
- Object
Overview
Enables reading and extracting of files from the given archive with #get
, #get_bytes
, #read_raw
and #extract
.
Files are cached automatically when using #get
or #get_bytes
; data is stored inside a Hash
.
Please make sure that you have enough memory.
Note: When reading from the archive, you have to use absolute paths.
The top level directory of the asar archive is the root. e.g.: /hello.txt
. Paths are case-sensitive.
Defined in:
asar-cr/extract.crConstructors
-
.new(asar : String)
Creates a new
Extract
for the given archive file.
Instance Method Summary
-
#extract(folder : String) : Bool
Extracts the archive to the provided folder.
-
#files
Returns an
Array(String)
that contains all files (absolute paths) that are in the archive. -
#files_cached
Returns an
Array(String)
of all files in the cache. -
#get(path : String) : IO::Memory | Nil
Returns an
IO::Memory
created from the cached file if found. -
#get_bytes(path : String) : Bytes | Nil
Returns the cached file if found.
- #header : Header
- #header=(header : Header)
-
#index_info(file : String) : Asar::File | Nil
Return the
Asar::File
, if found. - #io : ::File
- #io=(io : ::File)
-
#read_raw(path : String) : Bytes | Nil
Reads directly from the files
IO
, bypassing the cache if found.
Constructor Detail
Instance Method Detail
Extracts the archive to the provided folder.
Returns true
if successful.
Returns an Array(String)
that contains all files (absolute paths) that are in the archive.
Returns an IO::Memory
created from the cached file if found.
Else Nil
.
Return the Asar::File
, if found.
Else raises Nil
.
Reads directly from the files IO
, bypassing the cache if found.
Else Nil
.