function uploadFileToS3(file, options): Promise<File>

Uploads a file to S3 bucket.

Examples

import { downloadFile, PersistFileStrategy, uploadFileToS3 } from "@intuned/sdk/files";

const download = await downloadFile(page, {
  type: "DownloadByOpeningNewTab",
  downloadTrigger: (page) => page.locator(".download_button").click(),
});

const s3Configs: S3Configs = {
  bucket: 'my-bucket',
  region: 'us-west-1',
  accessKeyId: '....',
  secretAccessKey: '....'
};

const uploadedFile = await uploadFileToS3(download, { s3Configs });
console.log(uploadedFile.urlDescriptor());

Parameters

file: | string | Uint8Array | Buffer | ReadStream | Download

The file to upload, it can be a downloaded file by the downloadFile function or another content, the file can be Download | string | Uint8Array | Buffer | ReadStream

options

The options for uploading the file.

options.fileNameOverride?: string

Optional. Override for the file name.

options.s3Configs?: S3Configs

Optional. S3 configuration options.

Returns

Promise<File>

A promise that resolves to a File object.