@comparaonline/transfer-to-s3

Download a file and upload it to S3

Usage no npm install needed!

<script type="module">
  import comparaonlineTransferToS3 from 'https://cdn.skypack.dev/@comparaonline/transfer-to-s3';
</script>

README

Transfer to S3

Transfer a file on a URL to an S3 bucket. Usage:

import { TransferToS3 } from '@comparaonline/transfer-to-s3';

const transferToS3 = new TransferToS3({
  download: {
    timeout: 10000,
    attempts: 5,
    backoffTime: 2000,
  },
  s3: {
    bucket: 'my-bucket',
    accessKeyId: 'my-key-id',
    secretAccessKey: 'my-access-key',
    region: 'us-east-1'
  }
});

// optional:
transferToS3.setHeaders({ Authorization: 'Bearer THISSHOULDBEATOKEN'});

await transferToS3.transfer(
    'http://example.org/', 
    'directory/example-org-index.html'
);