sudo apt-get install g++
sudo apt-get install libfuse-dev
yum install fuse-devel
This tutorial explains how to install and use fuse4js.
git clone git://github.com/bcle/fuse4js.git
npm install fuse4js
node fuse4js/example/jsonFS.js fuse4js/example/sample.json /tmp/tutorial/mnt
fusermount -u /tmp/tutorial/mnt
-o outputJsonFilePathoption when starting the program.
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>
The tutorial used a local installation of fuse4js that is private to the /tmp/tutorial directory. To install fuse4js globally on your system:
npm install -g --unsafe-perm fuse4js
--unsafe-permoption seems to be necessary to work around an interference between the node-gyp compilation process and npm's downgrading of permissions when running a package's installation script (you may get an EACCES error without it)
/usr/local/lib/node_modules. To use it in your programs using a statement such as
fuse4js = require("fuse4js"), include
/usr/local/lib/node_modulesin your NODE_PATH environment variable. By default, node.js doesn't look in there for some reason, despite the fact that npm uses that directory as the default global installation location. Example:
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.
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.
mirrorFS.js sample program, so use that as the reference for now.
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.
Since fuse4js dynamically links with your system's FUSE library, which is a component of Linux, it is licensed under the GPL version 2. See the COPYING.txt file for details.
If you wish to submit code changes to this repository, please request a contribution agreement form from the author (VMware legal requires it).
Feel free to send bug reports and constructive feedback to the author: