mirror of
https://github.com/mgree/ffs.git
synced 2024-08-17 07:10:35 +03:00
the file filesystem: mount semi-structured data (like JSON) as a Unix filesystem
Mountpoints are typically inferred/generated from filenames with a -m/--mount flag for when reading from STDIN or to manually specify a mountpoint. |
||
---|---|---|
.github/workflows | ||
binary | ||
json | ||
src | ||
tests | ||
toml | ||
yaml | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE | ||
README.md | ||
run_tests.sh |
ffs: the file filesystem
ffs, the file filessytem, let's you mount semi-structured data as a fileystem---a tree structure you already know how to work with!
Working with semi-structured data using command-line tools is hard. Tools like 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.
Example
Run ffs [mountpoint] [file]
to mount a file at a given mountpoint.
$ ffs mnt json_eg1.json &
[1] 80762
$ tree mnt
mnt
└── glossary
├── GlossDiv
│ ├── GlossList
│ │ └── GlossEntry
│ │ ├── Abbrev
│ │ ├── Acronym
│ │ ├── GlossDef
│ │ │ ├── GlossSeeAlso
│ │ │ │ ├── 0
│ │ │ │ └── 1
│ │ │ └── para
│ │ ├── GlossSee
│ │ ├── GlossTerm
│ │ ├── ID
│ │ └── SortAs
│ └── title
└── title
6 directories, 11 files
$ cat mnt/glossary/GlossDiv/GlossList/GlossEntry/Abbrev
ISO 8879:1986$ cat mnt/glossary/GlossDiv/GlossList/GlossEntry/Acronym
SGML$ cat mnt/glossary/title
example glossary$ cat json_eg1.json
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}
$ ps | grep ffs
80762 ttys001 0:00.03 ffs mnt json_eg1.json
80843 ttys001 0:00.00 grep ffs
$ umount mnt
[1]+ Done ffs mnt json_eg1.json
$
External dependencies
You need an appropriate FUSE or macFUSE along with pkg-config.
See the GitHub build workflow for examples of external dependency installation.