AttachmentReader
Defined in: zaun/js/index.d.ts:710
An attachment read while it downloads. Every byte a read gives is plaintext of a chunk
whose SHA-256 the file’s description (sent by the host over the post-quantum connection)
named. The attachment’s own SHA3-256, and XFTP’s whole-file digest and tag, are checked
once every chunk was read in order: verified().
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AttachmentReader():
AttachmentReader
Returns
Section titled “Returns”AttachmentReader
Properties
Section titled “Properties”attachment
Section titled “attachment”
readonlyattachment:Attachment
Defined in: zaun/js/index.d.ts:711
readonlyraw:RawAttachmentReader
Defined in: zaun/js/index.d.ts:712
readonlysize:number
Defined in: zaun/js/index.d.ts:714
The attachment’s size in bytes.
Methods
Section titled “Methods”close()
Section titled “close()”close():
void
Defined in: zaun/js/index.d.ts:726
Stops the download; waiting and later reads reject with closed.
Returns
Section titled “Returns”void
progress()
Section titled “progress()”progress():
object
Defined in: zaun/js/index.d.ts:724
Encrypted bytes fetched so far (again after an eviction) and of the whole file.
Returns
Section titled “Returns”object
fetched
Section titled “fetched”fetched:
number
total:
number
read()
Section titled “read()”read(
offset,length,signal?):Promise<Uint8Array<ArrayBufferLike>>
Defined in: zaun/js/index.d.ts:718
Up to length bytes from offset: fewer when the range runs past what is downloaded,
none at the end. Waits for the first chunk the range needs. signal gives it up
(aborted); a failed check rejects with mismatch, a closed reader with closed.
Parameters
Section titled “Parameters”offset
Section titled “offset”number
length
Section titled “length”number
signal?
Section titled “signal?”AbortSignal
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
verified()
Section titled “verified()”verified():
Promise<void>
Defined in: zaun/js/index.d.ts:722
Resolves once every chunk went through the whole-file checks and the file’s size and
SHA3-256 are the attachment’s; rejects with mismatch (and fails every read after) when
not, or with why the download stopped.
Returns
Section titled “Returns”Promise<void>