4.3.8 • Published 3 years ago

overpass-ts v4.3.8

Weekly downloads
799
License
MIT
Repository
-
Last release
3 years ago

overpass-ts Node.js CI

promise-based overpass api client in typescript

  • works in browser & node
  • support json & xml/text & stream response
  • auto-retry if rate limit (409) or gateway timeout (504)
  • helpful error messages

installation

npm install overpass-ts

api

overpass(query, opt = {})

  • query: string Overpass API query
  • opt: object Query options

    • endpoint string Overpass API endpoint URL
    • rateLimitRetries number Number of retries when rate limited/gateway timeout-ed before giving up
    • rateLimitPause number Pause in between receiving a rate limited response and initiating a retry
    • verbose boolean Output verbose query information
    • stream boolean Return a stream.Readable (in Node) or ReadableStream (in browser)
    • fetchOpts object Options to be passed to fetch

Returns:

  • If query is [out:json], API response as JSON object
  • If query is [out:xml] or [out:csv], API response as string
  • If opt.stream = true, return stream.Readable (nodejs) / ReadableStream (browser)

example

import type { OverpassJson } from "overpass-ts";
import { overpass } from "overpass-ts";

// json request
overpass(`[out:json]; node(626639517); out ids;`).then((json) => {
  json = json as OverpassJson; // cast correct response type based on query
  assert.deepStrictEqual(json.elements[0], {
    type: "node",
    id: 626639517,
  });
});

license

MIT

4.3.6

3 years ago

4.3.5

3 years ago

4.3.8

3 years ago

4.3.7

3 years ago

4.3.2

3 years ago

4.3.1

3 years ago

4.3.4

3 years ago

4.3.3

3 years ago

4.3.0

3 years ago

4.2.3

3 years ago

4.2.4

3 years ago

4.2.2

3 years ago

4.1.0

3 years ago

4.2.0

3 years ago

4.0.2

3 years ago

4.0.1

3 years ago

3.1.3

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.1.5

3 years ago

3.1.4

3 years ago

4.0.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

0.14.0

3 years ago

0.13.0

3 years ago

0.12.0

3 years ago

0.11.0

3 years ago

0.9.0

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.5.0

3 years ago

0.6.0

3 years ago

0.3.0

3 years ago

0.4.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago