@superyachttimes/lib-uploader
v1.0.12
Published
Uploader library for the SuperYacht Times tech stack
Downloads
291
Readme
SYT Uploader
This small library allows SYT & YachtEye developers to upload (large) files directly to S3 in an very manner.
Usage
// set to true to enable debug logs
const enableDebugLogs = false
const onProgress = (progress) => {
// This is currently not yet used
console.log('Progress: ' + progress)
}
const onUploaded = ({ id, file, result }) => {
// the file was uploaded successfully
}
const uploader = new Uploader('https://api0.superyachtapi.com', 'MY_API_KEY', onProgress, onUploaded, enableDebugLogs)
/*
* @Param {File} file
* @Param {string} owner - e.g. current user ID or yacht ID
* @Param {string} service - e.g. "yachteye" or "sytiq"
*
* @Returns upload a file on behalf of service & owner
*/
await uploader.upload(file, owner, service)
NB The uploader will throw an error if anything fails along the way.