0.0.13 • Published 1 year ago

s3presignedurl_v3 v0.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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 .

Thank you for your support!

0.0.13

1 year ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago