@giveitsmaller/sdk
v0.4.0
Published
Node.js SDK for the GISL (Give It Smaller) file compression and processing API
Downloads
674
Readme
@giveitsmaller/sdk
TypeScript / Node.js SDK for the GISL (Give It Smaller) file compression and processing API.
Install
npm install @giveitsmaller/sdkNode.js 18+ required.
Quickstart
import { GislClient, uploadSource, OperationType } from '@giveitsmaller/sdk';
const client = new GislClient({
baseUrl: 'https://api.giveitsmaller.com',
apiKey: 'REPLACE_ME_API_KEY',
});
const upload = await client.uploadFile('./photo.jpg');
const workflow = await client.createWorkflow({
jobs: [
{
id: 'compressed',
source: uploadSource(upload.fileId),
operations: [
{ type: OperationType.compress, options: { mode: 'lossy', quality: 80 } },
],
},
],
});
await client.waitForWorkflow(workflow.workflowId);
const dls = await client.getWorkflowDownloads(workflow.workflowId);
console.log('Compressed:', dls.downloads[0].files[0].downloadUrl);Full documentation
Docs are published in the giveitsmaller-sdks repository — they are not shipped in the npm tarball (only dist/ is published).
- Getting started & concepts —
docs/typescript/index.md - Client reference (all
GislClientmethods + operation option list) —docs/typescript/client.md - Types & authoring primitives (config, payloads, job factories) —
docs/typescript/types.md - SSE / live progress —
docs/typescript/sse.md - Webhooks —
docs/typescript/webhook.md - Errors & retry guidance —
docs/typescript/errors.md - Troubleshooting —
docs/typescript/troubleshooting.md - Examples — compress, thumbnail, convert, merge, archive —
docs/typescript/examples/
License
MIT — see the LICENSE file.
