Skip to content

Commit

Permalink
update README to match latest example.js (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 authored and mafintosh committed Mar 12, 2017
1 parent a234e8e commit 627e708
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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')
}
})
})
```
Expand Down

0 comments on commit 627e708

Please sign in to comment.