1.0.0-alpha10 • Published 5 years ago

@gyselroth/balloon-node-fuse v1.0.0-alpha10

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

balloon FUSE bindings for node.js

Build Status GitHub release npm GitHub license

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

OptionTypeDefaultDescription
mountPointnull (Required)Path where balloon should be mounted.
cacheDirnullPath to directory where an offline cache is located.
cacheTTL5Cache time in seconds for node response TTL.
onnullEvent 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);