resultWithFile
resultWithFile(
result,fileData,mimeType,options?):GadgetExecuteResultWithMedia
Defined in: gadgets/helpers.ts:442
Create a result with a generic file output.
Use this for arbitrary file types that don’t fit image/audio categories.
Parameters
Section titled “Parameters”result
Section titled “result”string
Text result string
fileData
Section titled “fileData”Raw file data
Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>
mimeType
Section titled “mimeType”string
MIME type (required, not auto-detected)
options?
Section titled “options?”FileOptions
Optional description and cost
Returns
Section titled “Returns”A GadgetExecuteResultWithMedia
Example
Section titled “Example”const pdf = await generatePdf(content);return resultWithFile( "Generated PDF report", pdf, "application/pdf", { description: "Monthly report" });