2021-06-07 18:22:07 +03:00
|
|
|
# ffs: the file filesystem
|
2021-06-07 20:42:56 +03:00
|
|
|
[![Main workflow](https://github.com/mgree/ffs/actions/workflows/build.yml/badge.svg)](https://github.com/mgree/ffs/actions/workflows/build.yml)
|
2021-06-26 03:52:11 +03:00
|
|
|
[![Crates.io](https://img.shields.io/crates/v/ffs.svg)](https://crates.io/crates/ffs)
|
2021-06-07 18:22:07 +03:00
|
|
|
|
2021-08-11 15:53:49 +03:00
|
|
|
ffs, the **f**ile **f**ile**s**ystem, let's you mount semi-structured
|
|
|
|
data as a filesystem---a tree structure you already know how to work with!
|
2021-06-07 18:22:07 +03:00
|
|
|
|
2021-06-08 05:13:52 +03:00
|
|
|
Working with semi-structured data using command-line tools is hard.
|
|
|
|
Tools like [jq](https://github.com/stedolan/jq) help a lot, but
|
|
|
|
learning a new language for simple manipulations is a big ask. By mapping
|
|
|
|
hard-to-parse trees into a filesystem, you can keep using the tools you
|
|
|
|
know.
|
|
|
|
|
2021-06-09 02:57:47 +03:00
|
|
|
# Example
|
|
|
|
|
2021-08-24 16:53:29 +03:00
|
|
|
Run `ffs [file.blah]` to mount `file.blah` at the mountpoint `file`. The
|
2021-06-24 20:18:04 +03:00
|
|
|
final, updated version of the file will be outputted on stdout.
|
2021-06-09 02:57:47 +03:00
|
|
|
|
|
|
|
```shell-session
|
2021-06-24 18:05:57 +03:00
|
|
|
$ cat object.json
|
|
|
|
{ "name": "Michael Greenberg", "eyes": 2, "fingernails": 10, "human": true }
|
|
|
|
$ ffs -o object_edited.json object.json &
|
|
|
|
[1] 60182
|
|
|
|
$ tree object
|
|
|
|
object
|
|
|
|
├── eyes
|
|
|
|
├── fingernails
|
|
|
|
├── human
|
|
|
|
└── name
|
|
|
|
|
|
|
|
0 directories, 4 files
|
|
|
|
$ echo Mikey Indiana >object/name
|
|
|
|
$ echo 1 >object/nose
|
|
|
|
$ mkdir object/pockets
|
|
|
|
$ cd object/pockets/
|
|
|
|
$ echo keys >pants
|
|
|
|
$ echo pen >shirt
|
|
|
|
$ cd ..
|
|
|
|
$ cd ..
|
|
|
|
$ umount object
|
|
|
|
$
|
|
|
|
[1]+ Done ffs -o object_edited.json object.json
|
|
|
|
$ cat object_edited.json
|
|
|
|
{"eyes":2,"fingernails":10,"human":true,"name":"Mikey Indiana","nose":1,"pockets":{"pants":"keys","shirt":"pen"}}
|
2021-06-09 02:57:47 +03:00
|
|
|
```
|
|
|
|
|
2021-06-24 20:18:04 +03:00
|
|
|
You can specify an explicit mountpoint by running `ffs -m MOUNT file`;
|
|
|
|
you can specify an output file with `-o OUTPUT`. You can edit a file
|
|
|
|
in place by running `ffs -i file`---when the volume is unmounted, the
|
|
|
|
resulting output will be written back to `file`.
|
|
|
|
|
2021-06-07 18:22:07 +03:00
|
|
|
# External dependencies
|
|
|
|
|
2021-06-07 20:04:52 +03:00
|
|
|
You need an appropriate [FUSE](https://github.com/libfuse/libfuse) or
|
|
|
|
[macFUSE](https://osxfuse.github.io/) along with
|
2021-06-07 18:22:07 +03:00
|
|
|
[pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/).
|
|
|
|
|
2021-06-07 20:04:52 +03:00
|
|
|
See [the GitHub build
|
|
|
|
workflow](https://github.com/mgree/ffs/blob/main/.github/workflows/build.yml)
|
2021-06-07 20:09:24 +03:00
|
|
|
for examples of external dependency installation.
|