20 lines
605 B
JavaScript
20 lines
605 B
JavaScript
|
const Fuse = require('fuse-native')
|
||
|
const Errors = require('../../shared/Errors')
|
||
|
const Message = require('../../shared/Message')
|
||
|
const connector = require('../connector')
|
||
|
|
||
|
module.exports = exports = function (path, flags, cb) {
|
||
|
connector.send(
|
||
|
Message.route('fs.open')
|
||
|
.data({ path, flags })
|
||
|
.expect_response(msg => {
|
||
|
if ( msg.error() ) {
|
||
|
return Errors.toCallback(cb, msg.error())
|
||
|
}
|
||
|
|
||
|
const { descriptor } = msg.data()
|
||
|
return process.nextTick(cb, 0, descriptor)
|
||
|
})
|
||
|
)
|
||
|
}
|