Skip to content

probe-web / @probe-web/artifacts / downloadBytes

Function: downloadBytes()

ts
function downloadBytes(
   name, 
   bytes, 
   type?
): void;

Defined in: index.ts:384

Hand the user a file, e.g. a coredump or an exported memory region, as a download named name.

There is no showSaveFilePicker here on purpose: it is Chromium-only and needs a user gesture, whereas an object URL works wherever the rest of this does, including inside the sandboxed frame the tests run in.

The URL is revoked on the next task rather than immediately, because revoking it in the same tick can cancel the download in some browsers.

Parameters

ParameterTypeDefault value
namestringundefined
bytesArrayBuffer | Uint8Array<ArrayBufferLike>undefined
typestring'application/octet-stream'

Returns

void