fuse-bindings
Advanced tools
Comparing version 2.4.3 to 2.5.0
var fuse = require('./') | ||
fuse.mount('./mnt', { | ||
var mountPath = process.platform !== 'win32' ? './mnt' : 'M:\\' | ||
fuse.mount(mountPath, { | ||
readdir: function (path, cb) { | ||
@@ -18,4 +20,4 @@ console.log('readdir(%s)', path) | ||
mode: 16877, | ||
uid: process.getuid(), | ||
gid: process.getgid() | ||
uid: process.getuid ? process.getuid() : 0, | ||
gid: process.getgid ? process.getgid() : 0 | ||
}) | ||
@@ -32,4 +34,4 @@ return | ||
mode: 33188, | ||
uid: process.getuid(), | ||
gid: process.getgid() | ||
uid: process.getuid ? process.getuid() : 0, | ||
gid: process.getgid ? process.getgid() : 0 | ||
}) | ||
@@ -54,9 +56,10 @@ return | ||
if (err) throw err | ||
console.log('filesystem mounted on ./mnt') | ||
console.log('filesystem mounted on ' + mountPath) | ||
}) | ||
process.on('SIGINT', function () { | ||
fuse.unmount('./mnt', function () { | ||
fuse.unmount(mountPath, function () { | ||
console.log('filesystem at ' + mountPath + ' unmounted') | ||
process.exit() | ||
}) | ||
}) |
19
index.js
@@ -71,10 +71,15 @@ var bindings = require('bindings') | ||
var mount = function () { | ||
fs.stat(mnt, function (err, stat) { | ||
if (err) return cb(new Error('Mountpoint does not exist')) | ||
if (!stat.isDirectory()) return cb(new Error('Mountpoint is not a directory')) | ||
fs.stat(path.join(mnt, '..'), function (_, parent) { | ||
if (parent && parent.dev !== stat.dev) return cb(new Error('Mountpoint in use')) | ||
fuse.mount(mnt, ops) | ||
// TODO: I got a feeling this can be done better | ||
if (os.platform() !== 'win32') { | ||
fs.stat(mnt, function (err, stat) { | ||
if (err) return cb(new Error('Mountpoint does not exist')) | ||
if (!stat.isDirectory()) return cb(new Error('Mountpoint is not a directory')) | ||
fs.stat(path.join(mnt, '..'), function (_, parent) { | ||
if (parent && parent.dev !== stat.dev) return cb(new Error('Mountpoint in use')) | ||
fuse.mount(mnt, ops) | ||
}) | ||
}) | ||
}) | ||
} else { | ||
fuse.mount(mnt, ops) | ||
} | ||
} | ||
@@ -81,0 +86,0 @@ |
{ | ||
"name": "fuse-bindings", | ||
"version": "2.4.3", | ||
"version": "2.5.0", | ||
"description": "Fully maintained fuse bindings for Node that aims to cover the entire FUSE api", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,7 +14,15 @@ # fuse-bindings | ||
You need to have FUSE installed | ||
You need to have FUSE installed (or Dokany on Windows) | ||
* On Linux/Ubuntu `sudo apt-get install libfuse-dev` | ||
* On OSX install [OSXFuse](http://osxfuse.github.com/) | ||
* On OSX install [OSXFuse](http://osxfuse.github.com/) and pkg-config, `brew install pkg-config` | ||
* On Windows see `Windows` down below... | ||
### Windows | ||
**WARNING**: Dokany is still not quite stable. It can cause BSODs. Be careful. | ||
Using this on Windows is slightly more complicated. You need to install [Dokany](https://github.com/dokan-dev/dokany) (for `dokanfuse.lib`, `dokanctl.exe`, driver and service) **and** clone its repo (for the headers). | ||
Once the Dokany repo is cloned, you also need to set environment variable `DOKAN_INSTALL_DIR` to the path to `DokenLibrary` of your Dokany installaton, and `DOKAN_FUSE_INCLUDE` to the path to `*dokany repo*\dokan_fuse\include`. | ||
## Usage | ||
@@ -21,0 +29,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72495
16
486
468