Documentation Index Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Uploads files to AWS S3 storage with flexible configuration options.
This function accepts various file types including Playwright Download objects, binary data,
making it versatile for different upload scenarios. It automatically
handles file metadata and provides comprehensive S3 configuration options.
export declare function uploadFileToS3 ( input : {
file : FileType ;
configs ?: S3Configs ;
fileNameOverride ?: string ;
contentType ?: string ;
}) : Promise < Attachment >;
S3 configuration fallback
The function uses a fallback system to determine S3 settings:
S3Configs Parameter - If provided, uses the explicit configs object with your custom settings.
Environment Variables - If no configs provided, automatically reads from environment variables:
AWS_ACCESS_KEY_ID - Your AWS access key
AWS_SECRET_ACCESS_KEY - Your AWS secret key
AWS_REGION - AWS region (e.g., “us-west-1”)
AWS_BUCKET - S3 bucket name
AWS_ENDPOINT_URL - Optional custom S3 endpoint
Check Environment Variables & Secrets to learn more about setting environment variables.
Intuned Defaults - If environment variables aren’t set, falls back to Intuned’s managed S3 storage. See S3 Attachment Storage for more details.
Examples
Upload Downloaded File
Upload Binary Data
import { downloadFile , uploadFileToS3 } from "@intuned/browser" ;
import { BrowserContext , Page } from "playwright" ;
interface Params {}
export default async function handler (
params : Params ,
page : Page ,
context : BrowserContext
) {
await page . goto ( "https://sandbox.intuned.dev/pdfs" );
const download = await downloadFile ({
page ,
trigger: page . locator ( "xpath=//tbody/tr[1]//*[name()='svg']" ),
});
// Set your environment variables for the AWS credentials.
// Check https://docs.intunedhq.com/docs/02-features/environment-variables-secrets to learn more about setting environment variables.
const uploadedFile = await uploadFileToS3 ({
file: download ,
configs: {
bucket: process . env . AWS_BUCKET ,
region: process . env . AWS_REGION ,
accessKeyId: process . env . AWS_ACCESS_KEY_ID ,
secretAccessKey: process . env . AWS_SECRET_ACCESS_KEY ,
},
fileNameOverride: "reports/monthly-report.pdf" ,
});
console . log ( `File uploaded: ${ uploadedFile . suggestedFileName } ` );
}
Arguments
Configuration object for the upload operation The file to upload. Accepts FileType types including Playwright Download objects, Uint8Array, Buffer, or ReadStream Optional S3Configs for customizing the S3 upload. If not provided, uses environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, AWS_ENDPOINT_URL, AWS_BUCKET). If environment variables aren’t set, uses default Intuned S3 settings. Optional custom filename for the uploaded file. If not provided, uses the original filename or generates a unique name.
Optional MIME type for the uploaded file (e.g., “application/pdf”, “image/png”)
Returns: Promise<Attachment>
Promise that resolves to an Attachment object with file metadata and utility methods