leumas-audio
v0.1.0
Published
Official SDK for interacting with the A.Audio adapter middleware.
Readme
leumas-audio
Lightweight JavaScript/TypeScript SDK for working with the A.Audio middleware. It wraps the HTTP API (/get-all-adapters, /run-adapter) and handles audio uploads by encoding files to the payload format the server expects.
Installation
npm install leumas-audioUsage
import { LeumasAudioClient } from 'leumas-audio';
const client = new LeumasAudioClient({
baseUrl: 'http://localhost:50000/api'
});
const adapters = await client.listAdapters();
const run = await client.runAdapter('to-8d-audio', {
input: { foo: 'bar' },
files: [
{ inputName: 'audioFilePath', path: './song.wav' }
]
});
console.log(run.result);
console.log(run.downloads);API
new LeumasAudioClient(options?)
baseUrl(defaulthttp://localhost:50000/api)fetchcustom fetch implementationheadersdefault headers merged into every request
client.listAdapters()
Returns the same payload as /get-all-adapters.
client.runAdapter(adapterName, options)
adapterNamestringoptions.inputplain object merged into the request bodyoptions.filesarray of descriptors:{ inputName, path?, buffer?, dataUrl?, mimeType?, name? }
Files are converted into the __files payload automatically. Helpers encodeFileFromPath & encodeBuffer are exported for advanced scenarios.
