You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fuse-friends_fuse-native/index.js

40 lines
700 B

5 years ago
const binding = require('node-gyp-build')(__dirname)
console.log(binding)
class Fuse {
constructor () {
5 years ago
this._thread = Buffer.alloc(binding.sizeof_fuse_thread_t)
5 years ago
}
mount (mnt) {
5 years ago
binding.fuse_native_mount(mnt, '-odebug', this._thread, this, this.onop)
5 years ago
}
5 years ago
onop (handle) {
const ints = new Uint32Array(handle.buffer, handle.byteOffset, 32)
ints[0] = 1
ints[1] = 42
ints[2] = 10
5 years ago
process.nextTick(function () {
binding.fuse_native_signal(handle, -1)
5 years ago
})
}
}
5 years ago
5 years ago
const f = new Fuse()
5 years ago
5 years ago
f.mount('mnt')
5 years ago
setInterval(() => {
5 years ago
console.log(!!(f))
if (global.gc) gc()
5 years ago
}, 1000)
// setTimeout(function () {
// foo = null
// console.log('now!')
// }, 5000)