DEV Community


Posted on

Easy & Secure pre-signed URL for file access

A pre-signed URL is a valuable tool for providing temporary, controlled access to specific resources within a storage service, such as Amazon S3 or Google Cloud Storage.

By using pre-signed URLs, you can grant limited access to users without giving them full permissions to your storage account, set expiration times to automatically revoke access, reduce the server load by allowing direct access to resources, simplify authentication, and improve audibility and tracking of resource usage.

Setting one up with the Nitric framework is a breeze.

import { bucket } from '@nitric/sdk';

const assets = bucket('assets').for('reading', 'writing');

const logo = assets.file('images/logo.png');

// Create a read-only signed url reference for downloading
const downloadUrl = await logo.getDownloadUrl();

Enter fullscreen mode Exit fullscreen mode

See fully functional examples exposed via an API in typescript and python.

Top comments (0)