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_KEYpair to control their file system. - The API credentials allow the user to create access tokens
- Access tokens allow the user to do anything inside the
/(root) path in 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"
a permission format used as input to generate access tokens.
An ACP contains the following information:
- PERMS: what kind of operation(s) are allowed. possible values are
create,read,update,delete - PATH PATTERN: what subpath(s) are allowed. example values:
public/images/**.{jpeg|jpg|png},public/**.*,dist/bin/cli.exe
permission:/pseudo/regex/string/**/*.{exe|out|o|bin}
here are some examples of valid ACPs:
r:/projects/sfs/src.zip-read access to the file present at /projects/sfs/src.ziprcu:/projects/sfs/src/**.*-create,read andupdate access to file of ANY type (*.*) in ALL FILES OF ALL NESTED DIRECTORIES in src (**)rd:/tmp/artifacts/arm64-*.bin-read anddelete access to any file starting with name "arm64-" and having a ".bin" extension (arm64-*.bin) present in the "artifacts" directory. NO NESTED DIRECTORIES ARE PERMITTED due to the absence of**
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 curd:/home/users/johnd092/files/*.{jpeg|jpg|png|webp} as an ACP inside access token generation API
to generate an access token allowing john to perform all operations (read, create, update and delete) on the files that
are covered by the pseudo-regex string.
And this is all there is to SFS, no 30-hour certifications are required to move bytes between machines.
Now in closed alpha, to install the CLI run:
curl -sSL rmd.sh/sfs | bash