s3presignedurl_v3
TypeScript icon, indicating that this package has built-in type declarations

0.0.13 • Public • Published

s3PresignedUrl_v3

Getting presigned URLs using AWS SDK version 3 and env variables

You must have these environmen in your .env file

 AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
 AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
 AWS_DEFAULT_REGION=us-west-2

then check the following examples

get presigned url to upload a file

  
import { signedUrl, action } from 's3presignedurl_v3';

async function put () {
  const url = await signedUrl( {
    fileKey: 'test.txt',
    bucketName: 'bucket050520223',
    action: action.PUT,
    metadata: { owner: 'ucapistran' },
    endpoint: undefined, //! https://yourendpoint.com
    expiresIn: 3600
  });
  console.log(url)
} 

put()
  

get presigned url to download a file

 
import { signedUrl, action } from 's3presignedurl_v3';

async function get () {
const url = await signedUrl( {
   fileKey: 'test.txt',
   bucketName: 'bucket050520223',
   action: action.GET,
   metadata: {},
   endpoint: undefined, //! https://yourendpoint.com
   expiresIn: 3600
 });
 console.log(url)
} 

get()
 

If you find this project helpful or useful, please consider  Engineers love Coffee.

Thank you for your support!

Readme

Keywords

Package Sidebar

Install

npm i s3presignedurl_v3

Weekly Downloads

1

Version

0.0.13

License

MIT

Unpacked Size

10.8 kB

Total Files

5

Last publish

Collaborators

  • ucapistranmtz