Library for work with Uploadcare Upload API in Node.js and browsers.
npm install @uploadcare/upload-client --save
import UploadClient from '@uploadcare/upload-client'
const client = new UploadClient({publicKey: 'YOUR_PUBLIC_KEY'})
client.api.request({path: 'info', query})
.then(response => console.log(response.data))
client.api.info(uuid)
.then(data => console.log(data.is_image))
const directUpload = client.api.base(fileData)
directUpload
.then(data => console.log(data.file))
directUpload.onProgress = (progressEvent) => console.log(progressEvent.total / progressEvent.loaded)
const filePromise = client.fileFrom('object', fileData)
filePromise
.then(file => console.log(file.uuid))
filePromise.onProgress = (progress => {
console.log(progress.state)
console.log(progress.uploadProgress.total / progress.uploadProgress.loaded)
console.log(progress.value)
})
If you think you ran into something in Uploadcare libraries which might have security implications, please hit us up at [email protected] or Hackerone.
We'll contact you personally in a short time to fix an issue through co-op and prior to any public disclosure.
Issues and PRs are welcome. You can provide your feedback or drop us a support request at [email protected].