3

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-gzips the new content or b) denies write-access?

5
  • Is there something wrong with just using zcat?
    – jordanm
    Jan 14, 2013 at 16:42
  • @jordanm gzip was just an example, next time it could be tar or an entirely different program that (transparently) converts (one-way or two-way) between two data formats Jan 14, 2013 at 17:20
  • May I ask what you are trying to achieve by doing this, perhaps there's a simpler solution for your problem without the need of these special files.
    – Didi Kohen
    Jan 14, 2013 at 17:30
  • @DavidKohen In general? A transparent data conversion tool one output of which other programs can simply treat as files. I guess FUSE is the best choice here indeed Jan 14, 2013 at 17:46
  • That's what pipes are made for, though this may be an interesting FUSE file system.
    – Didi Kohen
    Jan 15, 2013 at 13:03

1 Answer 1

5

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.

4
  • 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
  • 1
    If 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.
    – Didi Kohen
    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
  • 1
    As 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .