0.0.13 • Published 6 months ago

s3presignedurl_v3 v0.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months 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

6 months ago

0.0.11

12 months ago

0.0.12

12 months ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago