import { Server , Socket } from 'socket.io' ; import adapter from '../adapters/oicqAdapter' ; export default ( io , socket , gin ) => { const gfs = adapter . acquireGfs ( gin ) ; socket . on ( 'ls' , async ( fid , start , cb ) => { const res = await gfs . ls ( fid , start ) ; cb ( res ) ; } ) ; socket . on ( 'download' , async ( fid , cb ) => { const res = await gfs . download ( fid ) ; cb ( res ) ; } ) ; socket . on ( 'stat' , async ( fid , cb ) => { const res = await gfs . stat ( fid ) ; cb ( res ) ; } ) ; socket . on ( 'mkdir' , async ( name , cb ) => { const res = await gfs . mkdir ( name ) ; cb ( res ) ; } ) ; socket . on ( 'mv' , async ( fid , dirId , cb ) => { const res = await gfs . mv ( fid , dirId ) ; cb ( res ) ; } ) ; socket . on ( 'rm' , async ( fid , cb ) => { const res = await gfs . rm ( fid ) ; cb ( res ) ; } ) ; socket . on ( 'rename' , async ( fid , name , cb ) => { const res = await gfs . rename ( fid , name ) ; cb ( res ) ; } ) ; } ;