Skip to content

Instantly share code, notes, and snippets.

@dakatsuka
Created November 3, 2011 17:50
Show Gist options
  • Save dakatsuka/1337177 to your computer and use it in GitHub Desktop.
Save dakatsuka/1337177 to your computer and use it in GitHub Desktop.
@foo = Foo.new
@foo.data = [params[:data].read].pack("H*")
@foo.save
var fs = require('fs');
var request = require('request')
var file = fs.readFileSync("/path/to/request.dat");
var body = file.toString('hex');
request.post({
method: 'POST',
uri: 'http://localhost:3000/foos',
multipart: [{
'Content-Disposition': 'attachment; name="data"; filename="data"',
'Content-Type': 'application/octet-stream;',
'Content-Length': body.length,
'body': body
}]},
function(error, response, body) {
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment