Menu

Create Time-Limited Download Links for Private Object Files in Node.js Explained
📰

Create Time-Limited Download Links for Private Object Files in Node.js Explained

DEV Community: node·AlgernonCross4103·10 days ago
#sMauhz2v
#devtonodejs#devto#dev#object#storage
Reading 0:00
15s threshold

To create time-limited download links for private object-storage files in Node.js, generate a presigned URL with the bucket, key, and expiry, then keep deletion on a separate retention clock. That is the answer for e-commerce exports.

Short answer: generate a presigned URL for a private object with its bucket, key, and expiry, then treat the URL as a temporary capability rather than as a public address. Keep the application contract around those inputs so the storage provider can change without forcing a rewrite through checkout, export jobs, and email delivery.

The awkward part is retention. An export can be deleted while an old link still exists, or a link can expire while the export remains in storage. I model both explicitly. For example, an order export might be retained for seven days, while each download link lives for 15 minutes.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.