https://www.npmjs.com/ (以下模塊可以在該網站找到對應的api文檔)
var superagent = require("superagent"),
cheerio = require("cheerio"),
async = require("async"),
eventproxy = require('eventproxy'),
mysql = require('mysql'), //加載mysql數據庫模塊
mongoose = require('mongoose'), //加載mongoose數據庫模塊
querystring = require("querystring"), //對http請求所帶的數據進行解析
restify = require('restify-clients'), //重新提取的HTTP客戶端。
log4js = require("log4js"), // node 日志管理
request = require('request'), //request模塊讓http請求變的更加簡單
redis = require("redis"), //redis數據庫模塊
download = require('download'), //下載
mysql
mysql(https://github.com/mysqljs/mysql)
mysql中文版:(http://www.oschina.net/translate/node-mysql-tutorial?utm_source=tuicool&utm_medium=referral)
redis
具體用法在github了解:(https://github.com/NodeRedis/node_redis)
request
具體用法在github了解:(https://github.com/request/request)
還可以在:(http://www.cnblogs.com/meteoric_cry/archive/2012/08/18/2645530.html)
log4js
具體用法在github了解:(https://github.com/nomiddlename/log4js-node)
還可以在:(http://www.cnblogs.com/Joans/p/4092293.html)
querystring
具體用法點開網址:(http://www.cnblogs.com/whiteMu/p/5986297.html)
download
具體用法在github了解:(https://github.com/kevva/download)
restify-clients
具體用法在github了解:(https://github.com/restify/clients)
superagent
superagent(http://visionmedia.github.io/superagent/ ) 是個輕量的的 http 方面的庫,是nodejs里一個非常方便的客戶端請求代理模塊,當我們需要進行 get 、 post 、 head 等網絡請求時,嘗試下它吧。
cheerio
cheerio(https://github.com/cheeriojs/cheerio ) 大家可以理解成一個 Node.js 版的 jquery,用來從網頁中以 css selector 取數據,使用方式跟 jquery 一樣一樣的。
中文版:(http://cnodejs.org/topic/5203a71844e76d216a727d2e )
eventproxy
eventproxy(https://github.com/JacksonTian/eventproxy ) 非常輕量的工具,但是能夠帶來一種事件式編程的思維變化。
用 js 寫過異步的同學應該都知道,如果你要并發異步獲取兩三個地址的數據,并且要在獲取到數據之后,對這些數據一起進行利用的話,常規的寫法是自己維護一個計數器。先定義一個 var count = 0,然后每次抓取成功以后,就 count++。如果你是要抓取三個源的數據,由于你根本不知道這些異步操作到底誰先完成,那么每次當抓取成功的時候,就判斷一下count === 3。當值為真時,使用另一個函數繼續完成操作。而 eventproxy 就起到了這個計數器的作用,它來幫你管理到底這些異步操作是否完成,完成之后,它會自動調用你提供的處理函數,并將抓取到的(數據當參數傳過來)。
async
async(https://github.com/caolan/async#queueworker-concurrency),async是一個流程控制工具包,提供了直接而強大的異步功能mapLimit(arr, limit, iterator, callback)。
這次我們要介紹的是 async 的 mapLimit(arr, limit, iterator, callback) 接口。另外,還有個常用的控制并發連接數的接口是 queue(worker, concurrency) ,大家可以去看看它的API。