@soundporn/sdk
v0.1.0
Published
TypeScript SDK for the sound.porn public API
Maintainers
Readme
@soundporn/sdk
Tiny, zero-dependency TypeScript client for the sound.porn public API. Works in Node 18+, browsers, and Deno (uses the global fetch).
Install
npm install @soundporn/sdkUsage
import { SoundpornClient } from '@soundporn/sdk';
const client = new SoundpornClient();
// Search
const { data } = await client.search('vine boom', { limit: 10 });
// Browse
const page = await client.list({ category: 'Memes', sort: 'popular', page: 1 });
// Single sound
const sound = await client.get_sound('vine-boom');
// Categories
const categories = await client.categories();
// Download MP3 bytes
const bytes = await client.download('vine-boom');Options
new SoundpornClient({
baseUrl: 'https://sound.porn', // default
fetch: customFetch, // optional
headers: { 'User-Agent': '…' },
});Errors throw SoundpornApiError with .status, .code, and .message.
License
MIT
