Use "Simple File Storage" for scenarios when you really can't use any NSFW words :)
A wrapper on top of your existing storage solutions like AWS's S3 or Cloudflare's R2.
Let me lay down a mental model of how SFS is a necessary and actually a good abstraction over traditional key-value mapped object storage solutions.
SFS creates an imaginary file system for you, which is intended to be like the file system you have on your machine.
- All users get one
API_SECRET
,API_KEY
pair to control their file system. - The API credentials allow the user to do anything inside the
/
(root) path inside their file system, user can create nested directories and files inside directories. - Users can provide fine-grained visibility and control of their own file system to other users via generating "access tokens" and fine-graining access by "ACPs"
Can be used in place of api credentials. generated by the owner of a file system to share access into subpath(s) of the file system.
as the owner of a file system, let's say I have a file tree in my file system that looks like this:
home/
- users/
- johnd092/
- files/
- profile.jpeg
- cover_image.jpeg
- resume.pdf
- apps/
- releases/
- bin1.exe
- bin2.exe
I have a user johnd092
wanting to edit his images in my file system, I can generate an access token for john and fine-grain
his access by passing in files_owner:/home/users/johnd092/files/*.{jpeg,jpg,png,webp}
as an "ACP" inside access token generation function
to generate an access token allowing john to own all the files (files_owner
) that are covered by the pseudo-regex string.
this special ":" separated string is called an ACP.
permission:/pseudo/regex/string/**/*.{exe,out,o,bin}
This is the core idea behind SFS HTTP Service, the CLI frontend to this service will extend the usability to popular use cases.
And unlike other services for which you might have to read a 50-pager doc, watch 5 fucking yt videos and read a 100 q/a's on Stack Overflow to just understand how the fuck this "pre-signed" url shit is supposed to work, this is all there is to SFS.
NOTE:
This is a heavy work in progress and not even functional as of me writing this readme (30 oct, 24)