remote task
1.0.0
用於遠端運行任務並將其輸出記錄到給定檔案的簡單伺服器
npm install remote-task
或者
npm install --save remote-task
伺服器:
var remoteTask = require ( 'remote-task' ) ;
var server = remoteTask ( 'tasks.log' ) ;
server . listen ( 3000 ) ;
客戶:
var remoteTask = require ( 'remote-task' ) ;
var remoteControl = remoteTask . remoteStream ( 3000 , '127.0.0.1' ) ; //IP address is optional, arguments are passed to net.connect()
remoteControl . write ( [ 'cd' , '/tmp' ] ) ;
remoteControl . write ( [ 'touch' , 'helloworld' ] ) ;
remoteControl . write ( { end : true } ) ;
remoteControl . on ( 'data' , function ( result ) {
console . log ( result . status ) ; //success, hopefully
} ) ;