Skip to content

DarrylPolo/ConvertAndStore-TypeScript-JavaScript-SDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convert and Store TypeScript / JavaScript SDK

Official JavaScript and TypeScript SDK for the Convert and Store API.

Use this package to:

  • authenticate with API keys or desktop session tokens
  • list and inspect tools
  • run file-based conversions across the live tool catalog
  • run URL-based tools such as website screenshots
  • upload, replace, download, encrypt, decrypt, move, share, and batch rename files
  • create and manage folders
  • work with shared folders
  • manage watch folders, team settings, team invitations, and team watch folders
  • manage webhook endpoints
  • update account vault settings

Install

From GitHub:

npm install github:DarrylPolo/ConvertAndStore-TypeScript-JavaScript-SDK

Or clone and build locally:

npm install
npm run build

Quick start

import { ConvertAndStoreClient } from "convertandstore-typescript-javascript-sdk";

const client = new ConvertAndStoreClient({
  apiKey: process.env.CONVERT_AND_STORE_API_KEY
});

const me = await client.getMe();
const tools = await client.listTools();

console.log(me.plan_code);
console.log(tools.length);

Browser or Node

The SDK is designed for both:

  • modern browsers with fetch, Blob, and FormData
  • Node.js 18+ with the built-in fetch stack

In Node, you can upload using:

  • a filesystem path
  • a Blob
  • a Uint8Array
  • an ArrayBuffer

In browsers, you can upload using:

  • File
  • Blob
  • ArrayBuffer
  • Uint8Array

API key or desktop token

For most backend workflows, use an API key:

const client = new ConvertAndStoreClient({
  apiKey: process.env.CONVERT_AND_STORE_API_KEY
});

For desktop-session style workflows, log in and persist the returned bearer token:

const client = new ConvertAndStoreClient();

const session = await client.loginWithPassword({
  email: "admin@convertandstore.com",
  password: "your-password",
  deviceName: "Node integration"
});

console.log(session.token);

Examples

Convert an image

const result = await client.convertTool("jpg-to-png", "./input/photo.jpg");
console.log(result.download_url);

Convert a URL-based tool

const screenshot = await client.takeWebsiteScreenshot("https://example.com", {
  viewport_width: 1440,
  viewport_height: 1024,
  delay_ms: 1200
});

console.log(screenshot.preview_url);

Create an archive from many files

const archive = await client.convertToolMany("zip-create", [
  "./docs/quote.pdf",
  "./docs/image.png",
  "./docs/data.csv"
], {
  archive_name: "project-delivery"
});

console.log(archive.download_url);

Upload a file into a folder

const uploaded = await client.uploadFile("./deliverables/final.pdf", {
  folderId: 42,
  title: "Final proposal",
  description: "Client-ready version"
});

Share a folder privately with another member

await client.shareFolderWithMember(18, "teammate@example.com");

Main methods

Public methods

  • getStatus()
  • listTools()
  • getTool(slug)

Auth and account

  • loginWithPassword(options)
  • logoutDesktop()
  • getMe()
  • setApiKey(apiKey)
  • setBearerToken(token)
  • clearToken()
  • updateVaultSettings({ vaultEnabled, autoEncryptUploads })

Files

  • listFiles(filters?)
  • getFile(fileId)
  • uploadFile(upload, options?)
  • replaceFile(fileId, upload, options?)
  • encryptFile(fileId)
  • decryptFile(fileId)
  • shareFile(fileId, isPublic?)
  • deleteFile(fileId)
  • moveFile(fileId, folderId?)
  • batchRenameFiles(fileIds, options?)
  • downloadFile(fileId)
  • saveFileDownload(fileId, destinationPath)

Folders and sharing

  • listFolders()
  • createFolder(name)
  • deleteFolder(folderId, options?)
  • listSharedFolders()
  • getSharedFolder(shareId)
  • downloadSharedFolderFile(shareId, fileId)
  • saveSharedFolderFileDownload(shareId, fileId, destinationPath)
  • shareFolderWithMember(folderId, memberIdentifier)
  • revokeFolderMemberShare(folderId, shareId)

Watch folders and sync

  • getWatchFolders()
  • createWatchFolder(attributes)
  • updateWatchFolder(ruleId, attributes)
  • deleteWatchFolder(ruleId)
  • getSyncManifest()

Team

  • getTeam()
  • updateTeam(attributes)
  • inviteTeamMember(email, role?)
  • revokeTeamInvitation(invitationId)
  • updateTeamMemberRole(membershipId, role)
  • removeTeamMember(membershipId)
  • createTeamWatchFolder(attributes)
  • updateTeamWatchFolder(ruleId, attributes)
  • deleteTeamWatchFolder(ruleId)

Webhooks

  • getWebhooks()
  • createWebhook({ name, endpointUrl, events })
  • deleteWebhook(endpointId)

Tool conversions

  • convertTool(slug, upload, options?)
  • convertToolMany(slug, uploads, options?)
  • convertToolFromUrl(slug, url, options?)
  • takeWebsiteScreenshot(url, options?)

Tool coverage

This SDK supports the live tool library through the generic tool conversion endpoint:

  • image tools
  • audio tools
  • video tools
  • web capture tools
  • PDF tools
  • spreadsheet tools
  • document tools
  • archive tools

As long as the public API exposes the tool under /api/v1/tools/{slug}/convert, this SDK can call it.

Tool options

Common option fields for tool conversions are documented in:

Error handling

The SDK throws typed errors:

  • ValidationError
  • AuthenticationError
  • ApiError
  • NetworkError

Example:

import { AuthenticationError, ConvertAndStoreClient } from "convertandstore-typescript-javascript-sdk";

try {
  const client = new ConvertAndStoreClient({ apiKey: "bad-token" });
  await client.getMe();
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error("Token rejected:", error.message);
  }
}

Notes

  • The SDK uses the live Convert and Store API at https://convertandstore.com by default.
  • Enterprise-only features such as some webhook and team workflows still depend on the account plan behind the token you use.
  • Download helpers that write directly to disk are Node-oriented.

About

TypeScript / JavaScript wrapper or ConvertAndStore.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors