Skip to content

Instantly share code, notes, and snippets.

@fictorial
Created December 8, 2009 22:25
Show Gist options
  • Save fictorial/252049 to your computer and use it in GitHub Desktop.
Save fictorial/252049 to your computer and use it in GitHub Desktop.
posix = require('posix');
sys = require('sys');
var writer = posix.open('/tmp/data', process.O_CREAT | process.O_WRONLY, 0666).wait();
var data = 42;
sys.puts("written: " + posix.write(writer, data, null, 'binary').wait());
posix.close(writer);
// file is 2 bytes in size and contains:
// 42
// not a 4 or 8 byte binary value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment