Skip to content

Commit

Permalink
use superagent
Browse files Browse the repository at this point in the history
  • Loading branch information
59naga committed Oct 25, 2015
1 parent eed2bf8 commit 833bca7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
5 changes: 0 additions & 5 deletions index.coffee

This file was deleted.

18 changes: 7 additions & 11 deletions package.json
@@ -1,13 +1,10 @@
{
"name": "caravan",
"version": "0.0.0-alpha",
"description": "throttle requests for easy to scrape",

"browser": {
"./src": false,
"request": false
},
"version": "0.0.0-beta",
"description": "throttle GET requests for easy to scrape",

"main": "lib",
"files": ["lib"],
"scripts": {
"start": "jasminetea --file index.coffee --watch",
"localhost": "zuul test --ui jasmine2 --server \"coffee test/app.coffee\" --local 59798 --open",
Expand All @@ -32,15 +29,14 @@

"dependencies": {
"bluebird": "^2.9.34",
"request": "^2.60.0",
"throat": "^2.0.2",
"xhr": "^2.0.3"
"superagent": "^1.4.0",
"throat": "^2.0.2"
},
"devDependencies": {
"express": "^4.13.3",
"ghooks": "^0.3.2",
"jasminetea": "^0.2.1",
"object-parser-cli": "0.0.1-alpha.1"
"object-parser-cli": "0.0.1"
},
"extraDependencies": {
"coffee-script": "^1.9.3",
Expand Down
7 changes: 4 additions & 3 deletions src/index.coffee
@@ -1,11 +1,12 @@
# Dependencies
Promise= require 'bluebird'
request= unless window? then require 'request' else require 'xhr'
request= require 'superagent'
throat= require 'throat'

# Public
class Caravan
fetchAll: (urls,options={})->
urls= [urls] if typeof urls is 'string'
options.concurrency?= 1

concurrency= throat options.concurrency
Expand All @@ -24,9 +25,9 @@ class Caravan
.then (results)->
for result in results
if result.isFulfilled()
result.value().body
result.value().text
else
result.reason()

module.exports= new Caravan
module.exports.Caravan= Caravan
module.exports.Caravan= Caravan

0 comments on commit 833bca7

Please sign in to comment.