Socket
Socket
Sign inDemoInstall

@aws-sdk/s3-request-presigner

Package Overview
Dependencies
Maintainers
5
Versions
434
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/s3-request-presigner

[![NPM version](https://img.shields.io/npm/v/@aws-sdk/s3-request-presigner/latest.svg)](https://www.npmjs.com/package/@aws-sdk/s3-request-presigner) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/s3-request-presigner.svg)](https://www.npmjs.com/


Version published
Weekly downloads
1.8M
decreased by-15.14%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/s3-request-presigner?

The @aws-sdk/s3-request-presigner package is part of the AWS SDK for JavaScript (v3) and is used to generate pre-signed URLs for AWS S3 objects. This allows clients to perform operations on S3 objects, such as GET or PUT, without requiring AWS credentials, by providing a URL that includes a signature. This is useful for providing temporary access to private objects, uploading files directly from a browser, or any other operation that you want to allow without giving out AWS credentials.

What are @aws-sdk/s3-request-presigner's main functionalities?

Generate pre-signed GET URL

This feature allows you to create a pre-signed URL for a GET request on an S3 object. The URL will be valid for the duration specified by 'expiresIn' (in seconds).

const { S3Client, GetObjectCommand } = require('@aws-sdk/client-s3');
const { getSignedUrl } = require('@aws-sdk/s3-request-presigner');

const s3Client = new S3Client({ region: 'us-west-2' });
const getObjectParams = { Bucket: 'my-bucket', Key: 'my-object-key' };
const command = new GetObjectCommand(getObjectParams);

const signedUrl = await getSignedUrl(s3Client, command, { expiresIn: 3600 });
console.log('The signed URL is:', signedUrl);

Generate pre-signed PUT URL

This feature allows you to create a pre-signed URL for a PUT request to upload an object to S3. The URL will be valid for the duration specified by 'expiresIn' (in seconds).

const { S3Client, PutObjectCommand } = require('@aws-sdk/client-s3');
const { getSignedUrl } = require('@aws-sdk/s3-request-presigner');

const s3Client = new S3Client({ region: 'us-west-2' });
const putObjectParams = { Bucket: 'my-bucket', Key: 'my-object-key' };
const command = new PutObjectCommand(putObjectParams);

const signedUrl = await getSignedUrl(s3Client, command, { expiresIn: 3600 });
console.log('The signed URL is:', signedUrl);

Other packages similar to @aws-sdk/s3-request-presigner

FAQs

Package last updated on 08 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc