Skip to content

Commit

Permalink
better example
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewosh committed Jul 31, 2019
1 parent 2e5dd42 commit d5747dd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,22 +251,23 @@ function getStatArray (stat) {
return ints
}

function emptyStat () {
function emptyStat (mode) {
return {
mtime: new Date(),
atime: new Date(),
ctime: new Date(),
nlink: 1,
size: 100,
mode: 16877,
mode: mode,
uid: process.getuid ? process.getuid() : 0,
gid: process.getgid ? process.getgid() : 0
}
}

const f = new Fuse('mnt', {
getattr: (path, cb) => {
return cb(0, emptyStat())
if (path === '/') return cb(0, emptyStat(16877))
return cb(0, emptyStat(33188))
},
access: (path, mode, cb) => {
return cb(0, 0)
Expand All @@ -279,7 +280,7 @@ const f = new Fuse('mnt', {
},
readdir: (path, cb) => {
if (path === '/') {
return cb(0, ['a', 'b', 'c'], Array(3).fill('a').map(() => emptyStat()))
return cb(0, ['a', 'b', 'c'], Array(3).fill('a').map(() => emptyStat(16877)))
}
return cb(0, [], [])
}
Expand Down

0 comments on commit d5747dd

Please sign in to comment.