Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
535 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | //////////////////////////////////////////
|
---|
| 2 | // This example demonstrates what happends
|
---|
| 3 | // when you use the built-in JSON parser.
|
---|
| 4 | //////////////////////////////////////////
|
---|
| 5 |
|
---|
| 6 | var fs = require('fs'),
|
---|
| 7 | stream = require('stream'),
|
---|
| 8 | needle = require('./../');
|
---|
| 9 |
|
---|
| 10 | var url = 'http://ip.jsontest.com/',
|
---|
| 11 | resp = needle.get(url, { parse: true });
|
---|
| 12 |
|
---|
| 13 | resp.on('readable', function(obj) {
|
---|
| 14 | var chunk;
|
---|
| 15 |
|
---|
| 16 | while (chunk = this.read()) {
|
---|
| 17 | console.log('root = ', chunk);
|
---|
| 18 | }
|
---|
| 19 | });
|
---|
| 20 |
|
---|
| 21 | resp.on('done', function() {
|
---|
| 22 | console.log('Done.');
|
---|
| 23 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.