Skip to content

Instantly share code, notes, and snippets.

@redfield
Created September 27, 2013 06:09
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 redfield/6724717 to your computer and use it in GitHub Desktop.
Save redfield/6724717 to your computer and use it in GitHub Desktop.
var FormData = require('form-data'),
fs = require("fs");
var form = new FormData();
form.append('user', 'HYPDF_USER');
form.append('password', 'HYPDF_PASSWORD');
form.append('test', 'true');
form.append('bucket', 'hypdf_test');
form.append('key', 'hypdf_test.pdf');
form.append('public', 'true');
form.append('file1', fs.createReadStream('/path/to/file1.pdf'));
form.append('file2', fs.createReadStream('/path/to/file2.pdf'));
form.append('file3', fs.createReadStream('/path/to/file3.pdf'));
form.submit('https://www.hypdf.com/pdfunite', function(err, res) {
// res – response object (http.IncomingMessage)
console.log(res.statusCode, res.resume());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment