Permalink
Browse files

Added examples to Readme file.

  • Loading branch information...
alexindigo committed Jul 30, 2012
1 parent 30af6be commit c406ac921d299cbc130464ed19338a9ef97cb650
Showing with 29 additions and 0 deletions.
  1. +29 −0 Readme.md
View
@@ -27,6 +27,35 @@ form.append('my_buffer', new Buffer(10));
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
```
+Also you can use http-response stream:
+
+``` javascript
+var FormData = require('form-data');
+var http = require('http');
+
+var form = new FormData();
+
+http.request('http://nodejs.org/images/logo.png', function(response)
+{
+ form.append('my_field', 'my value');
+ form.append('my_buffer', new Buffer(10));
+ form.append('my_logo', response);
+});
+```
+
+Or @mikeal's request stream:
+
+``` javascript
+var FormData = require('form-data');
+var request = require('request');
+
+var form = new FormData();
+
+form.append('my_field', 'my value');
+form.append('my_buffer', new Buffer(10));
+form.append('my_logo', request('http://nodejs.org/images/logo.png'));
+```
+
In order to submit this form to a web application, you can use node's http
client interface:

0 comments on commit c406ac9

Please sign in to comment.