Skip to main content

Mount archives as a filesystem.

Project description

Introduction

This package, explosive.fuse, provides a command-line tool, explode, for mounting of archive files (such as zip) to a directory using FUSE, enabling access to individual file entries within the compressed archives as normal files directly without the typical intermediate step of decompression to some temporary location, i.e. all file decompression is done dynamically, on demand. This library is constructed with modularity in mind to enable customization, such as how the file entries within the archives are to be presented at the mounted location, and that the helper classes and functions within can be reused elsewhere.

Currently, only zip archives are supported, with plans to support at least rar.

https://travis-ci.org/metatoaster/explosive.fuse.svg?branch=0.1.x https://coveralls.io/repos/metatoaster/explosive.fuse/badge.svg?branch=0.1.x

Installation

ExplosiveFUSE requires the FUSE kernel module for your operating system be available and Python 2.7/3.3+/PyPy. First off install the FUSE kernel module if it is not already installed.

For Debian/Ubuntu systems:

$ sudo apt-get install libfuse-dev

For RedHat/CentOS systems:

$ sudo yum install fuse-devel

This may or may not work on MacOS X via FUSE for OS X as the author has not tested this. If this works please inform the author via the issue tracker for this project.

Then simply install this package via pip, either in a virtualenv or at the system level, example:

$ pip install explosive.fuse

Usage

Simply invoking explode from the shell this help message will be presented:

usage: explode [-h] [-l <strategy>] [--layout-info] [-f] [-d]
               dir archives [archives ...]

In the most simple form the command can simply be invoked like so:

$ mkdir /tmp/mnt
$ explode /tmp/mnt demo1.zip

This will mount the contents of demo1.zip to /tmp/mnt. To verify that this worked, a simple ls can be used:

$ ls -l /tmp/mnt/
total 0
-r--r--r-- 1 root root 33 Oct 26 23:19 file1
-r--r--r-- 1 root root 33 Oct 26 23:19 file2
-r--r--r-- 1 root root 33 Oct 26 23:19 file3
-r--r--r-- 1 root root 33 Oct 26 23:19 file4
-r--r--r-- 1 root root 33 Oct 26 23:19 file5
-r--r--r-- 1 root root 33 Oct 26 23:19 file6

Currently, all files will simply be presented as owned by root and is read-only by all users. If you wish to restrict this simply ensure the directory before is only accessible to the desired users.

To unmount, simply call:

$ fusermount -u /tmp/mnt/

Or terminate the process if it was ran in the foreground.

It is possible to explode multiple archives onto the target directory:

$ explode /tmp/mnt demo1.zip demo2.zip

By default, a new layout strategy will be used, which will include the name of the source archive file. This can be verified:

$ ls -l /tmp/mnt/
total 0
dr-xr-xr-x 2 root root 0 Oct 26 23:22 demo1.zip
dr-xr-xr-x 2 root root 0 Oct 26 23:22 demo2.zip

Naturally, this can be changed by specifying the layout strategy with the -l or the --layout flag. For a detailed list please refer to the listing generated by explode --layout-info, but for completeness sake this is what is provided by a default installation:

flatten

Flattens the directory structure to the root by replacing all path separators for each file entries with the _ character.

junk

Junk all paths, keep only the basename of file entries.

root

Present file entries to the root of the mount point.

ziproot

Present file entries inside a directory named after its source archive file.

ziproot_flatten

Combining ziproot and flatten. Flattens the directory structure to the root by replacing all path separators for each file entries with the _ character, with all file names prepended with its source archive file name.

License

This work is licensed under GNU Generic Public License, version 3.

Changelog

0.1 (2015-10-26)

  • Initial release with just basic zip file support.

  • File extraction is naive, such that the entire contents of a single given file entry will be extracted to memory per read.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

explosive.fuse-0.1.tar.gz (8.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page