Edits history of script submission #6010 for ' Read a file from S3 within a script (Deno) (s3)'

  • deno
    // Details on S3 integration at https://www.windmill.dev/docs/core_concepts/persistent_storage/large_data_files
    
    import * as wmill from 'npm:[email protected]';
    import S3Object from 'npm:[email protected]';
    
    export async function main(input_file: S3Object) {
    	// Load the entire file_content as a Uint8Array
    	const file_content = await wmill.loadS3File(input_file);
    
    	const decoder = new TextDecoder();
    	const file_content_str = decoder.decode(file_content);
    	console.log(file_content_str);
    
    	// Or load the file lazily as a Blob
    	let fileContentBlob = await wmill.loadS3FileStream(input_file);
    	console.log(await fileContentBlob.text());
    }

    Submitted by henri186 832 days ago