DEV Community

Rak
Rak

Posted on

1

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.

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay