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.
Features
Uploading (Upload API):
- 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 (REST API):
- Get file info and perform various operations (store/delete/copy) with them
- Manage metadata
- Manage webhooks
- Convert documents
- Encode and transform videos
- Secure authentication
Image processing (URL API):
- Compression
- Geometry
- Colors
- Definition
- Image and text overlays
- Rotations
- Recognition
- File info
- Proxy (fetch)
Install
npm install @uploadcare/upload-client
npm install @uploadcare/rest-client
npm install @uploadcare/signed-uploads
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' })
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))
To upload files securely, you can use signed uploads.
For the REST API client you must specify both YOUR_PUBLIC_KEY
and YOUR_SECRET_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 })
Please, read the REST API client's authentication docs before use it.
Full documentation
Read the full documentation on JS API clients GitHub.