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