Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

featureservice

Package Overview
Dependencies
Maintainers
3
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

featureservice - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

LICENSE.MD

8

CHANGELOG.md

@@ -5,2 +5,9 @@ # Change Log

## [0.1.0] - 2015-08-05
### Added
* Requests time out after 5 minutes of inactivity by default
### Changed
* TCP sockets are kept alive
## [0.0.4] - 2015-07-29

@@ -28,2 +35,3 @@ ### Fixed

[0.1.0]: https://github.com/chelm/featureservice/ompare/v0.0.4...v0.1.0
[0.0.4]: https://github.com/chelm/featureservice/ompare/v0.0.3...v0.0.4

@@ -30,0 +38,0 @@ [0.0.3]: https://github.com/chelm/featureservice/ompare/v0.0.2...v0.0.3

28

index.js

@@ -1,4 +0,1 @@

// A module designed to talk to feature services and get every feature
// this code will expose methods for getting the URL to each page
var queue = require('async').queue

@@ -11,9 +8,16 @@ var http = require('http')

/**
* A feature service object needs a url and some optional params to make requests
* this module exposes a pageQueue that can take an array of page url
* the pageQueue will report back each page of features as they return
* @module FeatureService
* Feature Service constructor. Requires a URL.
* Exposes a pageQueue that can take an array of page URLs.
* The pageQueue will report back each page of features as they return.
*
* @class
* @param {string} url - address of feature service
* @param {object} options - layer (default: 0)
*/
var FeatureService = function (url, options) {
// catch omission of `new` keyword
if (!(this instanceof FeatureService)) {
return new FeatureService(url, options)
}
// check the last char on the url

@@ -30,2 +34,3 @@ // protects us from urls registered with layers already in the url

this.layer = options.layer || 0
this.timeOut = 5 * 60 * 1000

@@ -42,4 +47,2 @@ // an async for requesting pages of data

}
return this
}

@@ -54,2 +57,3 @@

var uri = urlUtils.parse(encodeURI(decodeURI(url)))
var self = this

@@ -59,2 +63,3 @@ var opts = {

port: (uri.protocol === 'https:') ? 443 : uri.port || 80,
keepAlive: true,
hostname: uri.hostname,

@@ -92,2 +97,7 @@ path: uri.path,

req.setTimeout(self.timeOut, function () {
req.end()
callback(new Error('The request timed out after ' + self.timeOut / 1000 + ' seconds.'))
})
req.on('error', function (error) {

@@ -94,0 +104,0 @@ callback(error)

{
"name": "featureservice",
"description": "a node module meant to extract every feature from an Esri geo-service thing",
"version": "0.0.4",
"version": "0.1.0",
"author": "Chris Helm",
"contributors": "Daniel Fenton",
"bugs": {
"url": "https://github.com/chelm/featureservice/issues"
"url": "https://github.com/dmfenton/featureservice/issues"
},

@@ -18,4 +19,5 @@ "dependencies": {

"minifyify": "^7.0.3",
"nock": "^2.10.0",
"sinon": "^1.15.4",
"standard": "^4.5.4",
"standard": "^5.0.0",
"tap-spec": "^4.0.2",

@@ -25,3 +27,3 @@ "tape": "^4.0.1",

},
"homepage": "https://github.com/chelm/featureservice",
"homepage": "https://github.com/dmfenton/featureservice",
"keywords": [

@@ -36,3 +38,3 @@ "esri",

"type": "git",
"url": "https://github.com/chelm/featureservice.git"
"url": "https://github.com/dmfenton/featureservice.git"
},

@@ -39,0 +41,0 @@ "scripts": {

@@ -65,1 +65,7 @@ # featureservice

## License
[Apache 2.0](LICENSE)
<!-- [](Esri Tags: ArcGIS Web Mapping GeoJson FeatureServices) -->
<!-- [](Esri Language: JavaScript) -->
var sinon = require('sinon')
var test = require('tape')
var FeatureService = require('../')
var nock = require('nock')

@@ -84,2 +85,16 @@ var service = new FeatureService('http://koop.dc.esri.com/socrata/seattle/2tje-83f6/FeatureServer/0', {})

test('time out when there is no response', function (t) {
var error
service.timeOut = 5
nock('http://www.timeout.com').get('/').socketDelay(100)
service.request('http://www.timeout.com', function (err, data) {
error = err
})
setTimeout(function () {
t.equal(typeof error, 'object')
t.end()
}, 25)
})
test('teardown', function (t) {

@@ -86,0 +101,0 @@ service.request.restore()

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc