txtsub
txtsub 是带有文本文件的 Node.js 的 Pub/sub。
例子
var client = require ( "txtsub" ) ;
var sub = client ( ) ;
sub . subscribe ( "test.txt" , function ( data ) {
console . log ( "alltext" , data . raw ) ;
console . log ( "diff" , data . diff ) ;
} ) ;
var pub = client ( ) ;
setTimeout ( function ( ) {
pub . publish ( "test.txt" , "hello" ) ; // "sub hello"
} , 1000 ) ;
安装
npm install txtsub
错误处理
v
1