1.1.1 • Published 8 months ago

@superyachttimes/lib-uploader v1.1.1

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
8 months ago

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)

/*
 * @Param {string} owner - e.g. current user ID or yacht ID
 * @Param {string} service - e.g. "yachteye" or "sytiq" (optional)
 *
 * @Returns a list of files uploaded by owner
 */
await uploader.getFiles(owner, [service])

NB The uploader will throw an error if anything fails along the way.

1.1.1

8 months ago

1.1.0

8 months ago

1.0.9

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago