import { $ } from "https://deno.land/x/capi@v0.1.1-beta.1/mod.ts";
const { EncodeBuffer } = $;
Properties
Methods
Pushes the data written in array to finishedArrays. Leaves the buffer in an invalid state -- array and index must be updated.
Copies all data from finishedArrays into fullArray
Creates a sub-buffer that can be written into later to insert data into the middle of the array.
.close()
must be called after the cursor is done being written into.
The cursor should not be used after .close()
is called.
If the cursor will be written into asynchronously, the buffer must be held open with .waitFor()
.
Finishes the current array, and returns a Uint8Array containing everything written. The EncodeBuffer is left in an undefined state, and should not be used afterwards. Throws if asynchronous writes are still pending.
Finishes the current array, and returns a Uint8Array containing everything written. The EncodeBuffer is left in an undefined state, and should not be used afterwards.
Inserts a Uint8Array at the current position in the buffer. This does not consume any of the pre-allocated space.
Finishes the current array and resumes writing on the previous array.
Must be called after .pushAlloc()
.
Allocates more space in the EncodeBuffer.
.popAlloc()
must be called after this space is used.
Consumes length
allocated bytes without writing anything, and returns the skipped subarray.
Anything written into the returned array will not affect the buffer,
except if it is later reincorporated e.g. via .insertArray()
.
Rather niche.
Immediately invokes the callback, and holds the buffer open until the returned promise resolves.
Invokes the callback once buffer's async tasks finish, and holds this buffer open until the callback returns.
Creates a sub-buffer that can be written into asynchronously. The buffer passed to the callback should not be used after the returned promise resolves.