balloon FUSE bindings for node.js
Install
npm install --save @gyselroth/balloon-node-fuse
npm install --save @gyselroth/balloon-sdk-node
Requirements
balloon-node-fuse requires an instance of @gyselroth/balloon-sdk-node.
Note: balloon-node-fuse requires fuse-bindings internally which itself requires a native fuse dependency. if balloon-node-fuse is somewhat packaged into a binary (For example via electron, nexe, ...) this dependency must be included. On Linux you may install the fuse package from your distribution. On Windows Dokany is required and on OS X osxfuse.
Usage
import { CoreV2Api, HttpBasicAuth } from '@gyselroth/balloon-sdk-node';
import { mount } from '@gyselroth/balloon-node-fuse';
var client = new CoreV2Api(args.server);
var basic = new HttpBasicAuth();
basic.username = 'admin';
basic.password = 'admin';
client.setDefaultAuthentication(basic);
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
var config = {
mountPoint: '/media/balloon',
};
mount(client, config).then(result => {
console.log('balloon mounted');
}).catch(error => {
console.log('mount error %s', error);
});
Install fuse
balloon-node-fuse requires fuse. This is usually installed on Linux based systems. On windows, dokany provides the necessary fuse bindings. dokany may be installed automatically using balloon-node-fuse. The same applies to OS X, there is no fuse by default but can be installed using the provided options.
import { install } from '@gyselroth/balloon-node-fuse';
install().then(result => {
console.log("fuse installed");
}).catch(error => {
console.log('install %s', error);
});
Options
Option | Type | Default | Description |
---|---|---|---|
mountPoint |
null (Required) |
Path where balloon should be mounted. | |
cacheDir | null |
Path to directory where an offline cache is located. | |
cacheTTL | 5 |
Cache time in seconds for node response TTL. | |
on | null |
Event binder to handle fuse events. |
Events
You may bind a callback to handle each fuse event individually:
var config = {
mountPoint: '/media/balloon',
on: function(e) {
console.log('fuse event', e);
}
};
mount(client, config);