Package Exports
- attache-upload
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (attache-upload) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
attache-upload.js
Upload your files to attache.
Example
import {upload, presign} from 'attache-upload'
presign(presign_url)
.then((presignResponse) => {
// presignResponse:
// {
// url: "http://path_to_your_attache_serve/upload",
// uuid: "5f0d4d62-e082-4cdf-a143-26258de59c47",
// expiration: 1461649282,
// hmac: "fd89637821afca1787dfe458be29bc87f0366122"
// }
return upload(presignResponse, fileObject)
})
.then((uploadResponse) => {
// Do something with the uploadResponse
// uploadResponse:
// {
// path: "54/4d/15/14/b4/09/29/01/36/42/2f/e2/3f/f0/42/15/some_file.jpg",
// content_type: "image/jpeg",
// geometry: "300x300",
// bytes: 19804
// }
})
.catch((err) => {
// Handle error
})API Documentation
presign(options)
presign_url- required, a URL to perform a presign request.token- optional,X-CSRF-Tokenvalue.
On success, this request will return:
url- the URL to the/uploadAPI of your attache serveuuid- a uuid stringexpiration- a unix timestamp of a future timehmac- theHMAC-SHA1of yourSECRET_KEY
upload(options)
presignResponse- required, response object passed in from presign request.fileObject- required, the file to be uploaded.onProgress- optional,onProgressfunction.
On success, this request will return:
path- a unique path for the uploaded filecontent_typegeometrybytes