Handbook
Glossary
read-zim ( path -- zim )
Vocabulary
zim
Inputs
path
an
object
Outputs
zim
an
object
Definition
USING:
accessors
arrays
classes.struct
combinators
destructors
io
io.encodings.binary
io.files
kernel
lru-cache
sequences
;
IN:
zim
:
read-zim
( path -- zim )
[
zim
new-disposable
]
dip
[
>>path
]
keep
binary
<file-reader>
[
>>stream
]
keep
[
zim-header
read-struct
[
>>header
]
keep
{
[
magic-number>>
72173914
assert=
]
[
mime-list-ptr-pos>>
seek-absolute
seek-input
read-mime-types
>>mime-types
]
[
dup
url-ptr-pos>>
seek-absolute
seek-input
entry-count>>
[
read-uint64
]
replicate
>>urls
]
[
dup
title-ptr-pos>>
seek-absolute
seek-input
entry-count>>
[
read-uint32
]
replicate
>>titles
]
[
entry-count>>
f
<array>
>>entries
]
[
dup
cluster-ptr-pos>>
seek-absolute
seek-input
cluster-count>>
[
read-uint64
]
replicate
>>clusters
]
}
cleave
32
<lru-hash>
>>cluster-cache
]
with-input-stream*
;