FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Why I Stopped Writing Video Files to Disk and Route Everything Through /tmp
NewsWeb Development

Why I Stopped Writing Video Files to Disk and Route Everything Through /tmp

via Dev.to Webdevjohn jewski1mo ago

When I built the first version of dltkk.to I made the obvious choice — download the video file, save it to a downloads folder, stream it to the user, clean up on a timer. Within a week I had three problems: Disk filling up when cleanup timers misfired on server restarts Stale files from failed downloads accumulating Potential privacy issue if a user's file sat on disk longer than it should Here's how I fixed all three by routing everything through /tmp . The Original Architecture (Wrong) // Old approach — save to disk, cleanup later const outputDir = ' ./downloads ' ; const filename = `video_ ${ Date . now ()} .mp4` ; const outputPath = path . join ( outputDir , filename ); const ytdlp = spawn ( ' yt-dlp ' , [ ' -o ' , outputPath , url ]); ytdlp . on ( ' close ' , ( code ) => { res . download ( outputPath , () => { fs . unlinkSync ( outputPath ); // What if this fails? }); }); // Cleanup timer as fallback setInterval (() => { // Delete files older than 10 minutes // But what if server

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
21 views

Related Articles

La historia de Ramiro..
News

La historia de Ramiro..

Dev.to • 6d ago

The Sonos Ace are a hefty 25 percent for Amazon’s Big Spring Sale
News

The Sonos Ace are a hefty 25 percent for Amazon’s Big Spring Sale

The Verge • 6d ago

Hooks in Claude Code
News

Hooks in Claude Code

Medium Programming • 6d ago

I Got Rejected for “Culture Fit” (What That Really Means)
News

I Got Rejected for “Culture Fit” (What That Really Means)

Medium Programming • 6d ago

The Apple Watch Series 9 is over 50% off during the Amazon Spring Sale for a limited time
News

The Apple Watch Series 9 is over 50% off during the Amazon Spring Sale for a limited time

ZDNet • 6d ago

Discover More Articles