20 lines
672 B
JavaScript
20 lines
672 B
JavaScript
const Fuse = require('fuse-native')
|
|
const Errors = require('../../shared/Errors')
|
|
const Message = require('../../shared/Message')
|
|
const connector = require('../connector')
|
|
const Streamer = require('../Streamer')
|
|
|
|
module.exports = exports = async function (path, fd, buffer, length, position, cb) {
|
|
try {
|
|
const { socket_uuid, node_uuid } = await connector.simple_request('stream.getfd', { descriptor: fd })
|
|
console.log({socket_uuid, node_uuid})
|
|
|
|
const streamer = new Streamer(socket_uuid, node_uuid, length, position)
|
|
streamer.write(buffer)
|
|
|
|
return process.nextTick(cb, length)
|
|
} catch (e) {
|
|
console.error(e)
|
|
}
|
|
}
|