GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ’– NAME πŸ’–

temporary-file β€” the Golf docs, but make it files ✨


🌸 DESCRIPTION 🌸

okay so bestie, you wanna make a temporary file? the move is uniq-file with a "temporary" clause. that's it. that's the whole vibe. πŸŽ€

and here's the thing β€” temporary files are literally just like any other files in the file-storage, organized the exact same way and everything, except they all live under the subdirectory named "t":

/var/lib/gg/<app_name>/app/file/t
🚨 not me about to drop the most important part: a temporary file is not automatically deleted. nope. no cap. nobody's coming to clean up after you.

so when you don't need it anymore, you remove it yourself with the delete-file statement β€” or, if you're feeling extra, use a periodic shell script to sweep away the old temporary files. πŸ‘‘

why tho? because the whole nature of temporary files varies, okay? they don't necessarily span a given time frame β€” like, they might not fit neatly inside the lifetime of a request, or the lifetime of a process that serves any number of those requests. they might get used across a bunch of requests for one specific purpose. so basically: it is your responsibility to remove a temporary file when it's appropriate for your application to do so. the file is not gonna delete itself, i fear. 😭

and why keep them in a whole separate directory? separation, bestie πŸ’… it's giving a clean split between temporary files (which, lowkey, at some point can probably just be freely deleted) and all your other files. iconic behavior honestly.

if you want to see it in action, go check out uniq-file β€” there's an example of creating a temporary file right there. πŸ¦‹


✨ SEE ALSO ✨

Files

also, the whole crew, fr fr: change-mode close-file copy-file delete-file file-position file-storage file-uploading lock-file open-file read-file read-line rename-file stat-file temporary-file uniq-file unlock-file write-file

and yes, you can See all documentation too 🫢


okay that's the page!! this lil tour of Golf's file docs was brought to you by $VERSION, dated $DATE, and it's filed under GOLF(2gg) in the Development section β€” mwah, go write some files bestie πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from