mirror of
https://github.com/rastapasta/mapscii.git
synced 2024-11-22 08:03:07 +01:00
Merge pull request #7 from derhuerst/fetch
request-promise -> node-fetch
This commit is contained in:
commit
1e545aa85a
@ -64,7 +64,7 @@ If your terminal supports mouse events you can drag the map and use your scroll
|
|||||||
|
|
||||||
#### Handling the flow
|
#### Handling the flow
|
||||||
* [`bluebird`](https://github.com/petkaantonov/bluebird) for all the asynchronous [Promise](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Promise) magic
|
* [`bluebird`](https://github.com/petkaantonov/bluebird) for all the asynchronous [Promise](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Promise) magic
|
||||||
* [`request-promise`](https://github.com/request/request-promise) for promisified HTTP request handling
|
* [`node-fetch`](https://github.com/bitinn/node-fetch) for HTTP requests
|
||||||
* [`userhome`](https://github.com/shama/userhome) to determine where to persist downloaded tiles
|
* [`userhome`](https://github.com/shama/userhome) to determine where to persist downloaded tiles
|
||||||
|
|
||||||
### TODOs
|
### TODOs
|
||||||
|
@ -34,10 +34,9 @@
|
|||||||
"coffee-script": "^1.10.0",
|
"coffee-script": "^1.10.0",
|
||||||
"earcut": "^2.1.1",
|
"earcut": "^2.1.1",
|
||||||
"keypress": "^0.2.1",
|
"keypress": "^0.2.1",
|
||||||
|
"node-fetch": "^1.6.3",
|
||||||
"pbf": "^3.0.0",
|
"pbf": "^3.0.0",
|
||||||
"rbush": "^2.0.1",
|
"rbush": "^2.0.1",
|
||||||
"request": "^2.76.0",
|
|
||||||
"request-promise": "^4.1.1",
|
|
||||||
"simplify-js": "^1.2.1",
|
"simplify-js": "^1.2.1",
|
||||||
"term-mouse": "^0.1.1",
|
"term-mouse": "^0.1.1",
|
||||||
"userhome": "^1.0.0",
|
"userhome": "^1.0.0",
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
|
|
||||||
Promise = require 'bluebird'
|
Promise = require 'bluebird'
|
||||||
userhome = require 'userhome'
|
userhome = require 'userhome'
|
||||||
request = require 'request'
|
fetch = require 'node-fetch'
|
||||||
rp = require 'request-promise'
|
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
|
|
||||||
Tile = require './Tile'
|
Tile = require './Tile'
|
||||||
@ -77,9 +76,8 @@ module.exports = class TileSource
|
|||||||
if config.persistDownloadedTiles and tile = @_getPersited z, x, y
|
if config.persistDownloadedTiles and tile = @_getPersited z, x, y
|
||||||
Promise.resolve tile
|
Promise.resolve tile
|
||||||
else
|
else
|
||||||
rp
|
fetch @source+[z,x,y].join("/")+".pbf"
|
||||||
uri: @source+[z,x,y].join("/")+".pbf"
|
.then (res) => res.buffer()
|
||||||
encoding: null
|
|
||||||
.then (buffer) =>
|
.then (buffer) =>
|
||||||
@_persistTile z, x, y, buffer if config.persistDownloadedTiles
|
@_persistTile z, x, y, buffer if config.persistDownloadedTiles
|
||||||
buffer
|
buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user