Skip to content

Instantly share code, notes, and snippets.

@changtimwu
Created March 18, 2013 02:01
Show Gist options
  • Select an option

  • Save changtimwu/5184510 to your computer and use it in GitHub Desktop.

Select an option

Save changtimwu/5184510 to your computer and use it in GitHub Desktop.
var fs =require( 'fs');
var devfn='/dev/ttyS1'
var txFd = fs.openSync( devfn, 'w');
var rxfd = fs.openSync( devfn, 'r');
var txBuf = new Buffer('hello');
var txBytesWritten = fs.writeSync(txFd, txBuf, 0, txBuf.length, -1);
console.log("written bytes=", txBytesWritten);
fs.closeSync(txFd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment