Skip to content

Commit ab3a6a5

Browse files
committed
Syntax highlighting
1 parent 8c744e5 commit ab3a6a5

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

Readme.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,34 @@ Sorry, this isn't ready for you yet.
1616
In this example we are constructor a form with 3 fields that contain a string,
1717
a buffer and a file stream.
1818

19-
var FormData = require('form-data');
20-
var fs = require('fs');
19+
``` javascript
20+
var FormData = require('form-data');
21+
var fs = require('fs');
2122

22-
var form = new FormData();
23-
form.append('my_field', 'my value');
24-
form.append('my_buffer', new Buffer(10));
25-
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
23+
var form = new FormData();
24+
form.append('my_field', 'my value');
25+
form.append('my_buffer', new Buffer(10));
26+
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
27+
```
2628

2729
In order to submit this form to a web application, you can use node's http
2830
client interface:
2931

30-
var http = require('http');
32+
``` javascript
33+
var http = require('http');
3134

32-
var request = http.request({
33-
method: 'post',
34-
host: 'example.org',
35-
path: '/upload',
36-
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
37-
});
35+
var request = http.request({
36+
method: 'post',
37+
host: 'example.org',
38+
path: '/upload',
39+
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
40+
});
3841

39-
form.pipe(request);
42+
form.pipe(request);
4043

41-
request.on('response, function(res) {
42-
console.log(res.statusCode);
43-
});
44+
request.on('response, function(res) {
45+
console.log(res.statusCode);
46+
});
47+
```
4448
4549
[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface

0 commit comments

Comments
 (0)