Skip to content

Instantly share code, notes, and snippets.

@matylla
Created June 5, 2012 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matylla/2873804 to your computer and use it in GitHub Desktop.
Save matylla/2873804 to your computer and use it in GitHub Desktop.
arduino and node - saving raw data as a file
var fs = require('fs');
var writeStream = fs.createWriteStream(__dirname + 'jpeg.jpg');
serialPort.on('data', function(data) {
// data is: FF D8 ...
writeStream.write(new Buffer(data, 'hex'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment