s3-signed-url
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

s3-signed-url

A simple library to generate a presigned URL for an Amazon S3 object.

Table of Contents

Installation

Install the package using npm:

npm install s3-signed-url

Usage

Import the createPresignedUrl function and use it to generate a presigned URL for your S3 object:

import { createPresignedUrl } from "s3-signed-url";

(async () => {
  const signedUrl = await createPresignedUrl({
    region: "us-east-1",
    bucket: "example-bucket",
    key: "example-key",
    expiresIn: 3600, // Optional, in seconds
  });

  console.log("Signed URL:", signedUrl);
})();

API

createPresignedUrl(options: CreatePresignedUrlOptions): Promise

Generates a presigned URL for an S3 object.

Parameters

  • options: An object containing the following properties:
    • region: The AWS region where the S3 bucket is located (e.g., "us-east-1").
    • bucket: The name of the S3 bucket containing the object.
    • key: The key of the S3 object for which you want to generate a presigned URL.
    • expiresIn: (Optional) The expiration time of the presigned URL in seconds. Defaults to 3600.

Returns

A Promise that resolves to the presigned URL as a string.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Package Sidebar

Install

npm i s3-signed-url

Weekly Downloads

4

Version

1.2.0

License

ISC

Unpacked Size

4.24 kB

Total Files

6

Last publish

Collaborators

  • sagarah