Given e.g. a gzipped textfile file.txt.gz
, how to create a special file file.txt
that on reading yields the (interactively) decompressed contents of the .gz
file, and on writing a) re-gzip
s the new content or b) denies write-access?
1 Answer
Under Linux (or FreeBSD, NetBSD, MacOS X) FUSE comes to mind, it already features some Archive File Systems, that you should have a look at.
If the FUSE-mounted virtual file system just passes through non-archive-files, this could be what you want.
-
Yes, FUSE sounds like it can do it, though I wonder if one can mount to a file instead of a directory containing a dummy file (if the example's archive contains only compressed data) Jan 14, 2013 at 17:25
-
1If you are talking about a few files, you may be able to do something like this with softlinks (so it'll be files and not directories) and FUSE, of you are talking many (100+) I think you need to go elsewhere. Jan 14, 2013 at 17:28
-
1@DavidKohen Good point. It would only be a couple of files, so an alias that mounts to a
mktemp
directory and softlinking would suffice indeed Jan 14, 2013 at 17:33 -
1As it doesn't seem completely unrelated, I'd like to point out that some filesystems (among them Btrfs, Reiser4 and ZFS) support (per-filesystem) transparent compression– sr_Jan 15, 2013 at 7:33
zcat
?gzip
was just an example, next time it could betar
or an entirely different program that (transparently) converts (one-way or two-way) between two data formats