audioFromBuffer
audioFromBuffer(
buffer,mediaType?):AudioContentPart
Defined in: core/input-content.ts:378
Create an audio content part from a Buffer or Uint8Array. Automatically detects the MIME type if not provided.
Parameters
Section titled “Parameters”buffer
Section titled “buffer”Audio data
Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>
mediaType?
Section titled “mediaType?”Optional MIME type (auto-detected if not provided)
Returns
Section titled “Returns”Example
Section titled “Example”const audioData = await fs.readFile("audio.mp3");const part = audioFromBuffer(audioData); // Auto-detects MP3