clipboard-worker
Base64 codec for clipboard payloads, run off the main thread.
lib/clipboard-worker-bridge.js posts {id, action, payload, mimeType}
and receives {id, success, result, mimeType, byteLength} or
{id, success: false, error}. ENCODE_BINARY_TO_B64 takes an
ArrayBuffer, ENCODE_TEXT_TO_B64 a string, both answering with the base64
text; DECODE_FROM_B64 takes base64 and answers with a string for
text/plain, else with a transferred ArrayBuffer. byteLength is the
decoded size, which the bridge reports and compares against limits.
Variables
CHUNK_SIZE
const CHUNK_SIZE: 32768 = 0x8000;Defined in: clipboard-worker.js:21
Bytes per String.fromCharCode.apply call, keeping its argument list bounded.
Functions
stringToBase64()
function stringToBase64(text): string;Defined in: clipboard-worker.js:27
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | - |
Returns
string
Base64 of the UTF-8 encoding of text.
base64ToString()
function base64ToString(base64): object;Defined in: clipboard-worker.js:41
Parameters
| Parameter | Type | Description |
|---|---|---|
base64 | string | - |
Returns
object
The decoded UTF-8 text and its byte size.
text
text: string;byteLength
byteLength: number;base64ToBytes()
function base64ToBytes(base64): Uint8Array<ArrayBufferLike>;Defined in: clipboard-worker.js:55
Parameters
| Parameter | Type | Description |
|---|---|---|
base64 | string | - |
Returns
Uint8Array<ArrayBufferLike>
bytesToBase64()
function bytesToBase64(bytes): string;Defined in: clipboard-worker.js:69
Parameters
| Parameter | Type | Description |
|---|---|---|
bytes | Uint8Array<ArrayBufferLike> | - |
Returns
string