JS API clients

JS API clients handle uploads and file operations by wrapping Uploadcare Upload API and REST API. You can use it from withing your Node.js app and in a browser.

GitHub

Features

Upload features:

  • Upload files from local storage and URLs (up to 5 TB)
  • Multipart uploading for large files
  • Track uploading progress
  • Bulk file uploading
  • Uploading network to speed uploading jobs (like CDN)
  • Secure uploads (signed uploads)

File management features:

  • Get file info and perform various operations (store/delete/copy) with them
  • Manage metadata
  • Manage webhooks
  • Convert documents
  • Encode and transform videos
  • Secure authentication

Install

npm install @uploadcare/upload-client
npm install @uploadcare/rest-clientbash

Usage examples

To access the Upload Client High-Level API, you need to create an instance of UploadClient providing the necessary settings. Specifying YOUR_PUBLIC_KEY is mandatory. It points to the specific Uploadcare project:

import UploadClient from '@uploadcare/upload-client'

const client = new UploadClient({ publicKey: 'YOUR_PUBLIC_KEY' })javascript

Once the UploadClient instance is created, you can start using the wrapper to upload files from binary data:

client
  .uploadFile(fileData)
  .then(file => console.log(file.uuid))javascript

For the REST API client you must specify both YOUR_PUBLIC_KEY and YOUR_PRIVATE_KEY:

import { listOfFiles, UploadcareSimpleAuthSchema } from '@uploadcare/rest-client';

const uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({
  publicKey: 'YOUR_PUBLIC_KEY',
  secretKey: 'YOUR_SECRET_KEY',
});

const result = await listOfFiles({}, { authSchema: uploadcareSimpleAuthSchema })javascript

Please, read the REST API client's authentication docs before use it.

Full documentation

Read the full documentation on GitHub.