Home

Awesome

Fuse4js

Fuse4js provides Javascript bindings to the FUSE subsystem of Linux. It enables you to develop user-space file systems with node.js.

Requirements

Linux:

OSX:

Tutorial

This tutorial explains how to install and use fuse4js.

Once you are comfortable with the sample program, you can move on to the second example, mirrorFS.js. It is equivalent to the fusexmp.c sample program that ships with the FUSE source code. As its name indicates, it maps an existing file system subtree to a mount point of your choice. It demonstrates more advanced features such as file handles. The syntax is: node fuse4js/example/mirrorFS.js <file_system_directory> <new_mount_point>

Global installation

The tutorial used a local installation of fuse4js that is private to the /tmp/tutorial directory. To install fuse4js globally on your system:

Installation from NPM registry

As of September 17, 2012, fuse4js has been added to the NPM registry, so you can skip the git download step and install it directly by typing:
npm install fuse4js
This will put the module under a local node_modules/ subdirectory.

API Documentation

Fuse4js currently implements a subset of all FUSE file operations. More will be added over time, but the initial set is sufficient to implement a basic read/write file system.

You implement a file system by registering Javascript handler functions with fuse4js. Each handler handles a particular FUSE operation. While the arguments passed to a handler vary depending on the requested operation, the last argument is always a callback function that you invoke when you are finished servicing the request. The arguments to the callback typically include an error code, followed by zero or more additional arguments depending on the FUSE operation. Following FUSE conventions, the error code is set to a negated 'errno' value to indicate error, and zero or a positive value (for read/write operations) to indicate success.

We currently don't have a separate document describing the Javascript interface corresponding to each FUSE operation. Instead, the API is documented in the comments for each handler in the mirrorFS.js sample program, so use that as the reference for now.

How it Works

The FUSE event loop runs in its own thread, and communicates with the node.js main thread using an RPC mechanism based on a libuv async object and a semaphore. There are a couple of context switches per FUSE system call. Read/Write operations also involve a copy operation via a node.js Buffer object.

ToDo List

License

Fuse4js is released under the terms of the MIT license. See the LICENSE.txt file for details.

Contributing

If you wish to submit code changes to this repository, please request a contribution agreement form from the maintainer (VMware legal requires it).

Contact

Feel free to send bug reports and constructive feedback to the maintainer: fuse4js@vmware.com