1
0
mirror of https://github.com/fuse-friends/fuse-native synced 2024-10-27 18:34:01 +00:00

update README to match latest example.js (#50)

This commit is contained in:
Sam Kelly 2017-03-12 06:46:01 -04:00 committed by Mathias Buus
parent a234e8eb95
commit 627e708064

View File

@ -35,7 +35,9 @@ Try creating an empty folder called `mnt` and run the below example
``` js
var fuse = require('fuse-bindings')
fuse.mount('./mnt', {
var mountPath = process.platform !== 'win32' ? './mnt' : 'M:\\'
fuse.mount(mountPath, {
readdir: function (path, cb) {
console.log('readdir(%s)', path)
if (path === '/') return cb(0, ['test'])
@ -50,8 +52,8 @@ fuse.mount('./mnt', {
ctime: new Date(),
size: 100,
mode: 16877,
uid: process.getuid(),
gid: process.getgid()
uid: process.getuid ? process.getuid() : 0,
gid: process.getgid ? process.getgid() : 0
})
return
}
@ -63,8 +65,8 @@ fuse.mount('./mnt', {
ctime: new Date(),
size: 12,
mode: 33188,
uid: process.getuid(),
gid: process.getgid()
uid: process.getuid ? process.getuid() : 0,
gid: process.getgid ? process.getgid() : 0
})
return
}
@ -82,13 +84,18 @@ fuse.mount('./mnt', {
buf.write(str)
return cb(str.length)
}
}, function (err) {
if (err) throw err
console.log('filesystem mounted on ' + mountPath)
})
process.on('SIGINT', function () {
fuse.unmount('./mnt', function (err) {
if (err) throw err
process.exit()
fuse.unmount(mountPath, function (err) {
if (err) {
console.log('filesystem at ' + mountPath + ' not unmounted', err)
} else {
console.log('filesystem at ' + mountPath + ' unmounted')
}
})
})
```