This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.mongodb.org/display/DOCS/dbshell+%28mongo%29+Reference |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
var http = require('http'); | |
function getPage(callback) { | |
http.get('http://www.baidu.com', function(res) { | |
var buffers = []; | |
var size = 0; | |
res.on('data', function(buffer) { | |
buffers.push(buffer); | |
size += buffer.length; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var options = { | |
host: 'www.baidu.com', | |
port: 80, | |
path: '/s?wd=gfw' | |
}; | |
var Iconv = require('iconv').Iconv; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RES_MAX = 10; | |
var count = 0; | |
function foo () { | |
if (count > RES_MAX) { | |
//出让cpu,等待并发任务完成 | |
return process.nextTick(foo); | |
} | |
//do the real work here | |
count ++; |
NewerOlder