mirror of
https://github.com/mgree/ffs.git
synced 2024-10-27 04:22:43 +03:00
the file filesystem: mount semi-structured data (like JSON) as a Unix filesystem
.github/workflows | ||
json | ||
src | ||
tests | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE | ||
README.md |
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.
TODO
ListDirectory
(need element names, otherwise basically the same)- Filenames
- Check on validity of filenames/fieldnames
- Options for naming of ListDirectory elements
- Metadata (as extensions or as dotfiles)
- Debugging/logging
- Instrument all
Filesystem
trait methods - Timing
- Clean stderr output for
error!
andwarn!
- Quiet mode
- Instrument all
- Writable FS
- JSON output