tileblaster 0.4.7 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tileblaster.js +14 -10
- package/package.json +9 -3
package/lib/tileblaster.js
CHANGED
|
@@ -128,9 +128,9 @@ tileblaster.prototype.reconfigure = function(config){
|
|
|
128
128
|
|
|
129
129
|
// check for subdomain feature
|
|
130
130
|
if (map.url.indexOf("{s}") >= 0) {
|
|
131
|
-
if (!map.sub) throw new Error("no subdomains configured for map "+
|
|
131
|
+
if (!map.sub) throw new Error("no subdomains configured for map "+id);
|
|
132
132
|
if (typeof map.sub === "string") map.sub = map.sub.split("");
|
|
133
|
-
if (!(map.sub instanceof Array)) throw new Error("invalid 'sub' option for map "+
|
|
133
|
+
if (!(map.sub instanceof Array)) throw new Error("invalid 'sub' option for map "+id);
|
|
134
134
|
} else {
|
|
135
135
|
map.sub = false;
|
|
136
136
|
}
|
|
@@ -427,7 +427,7 @@ tileblaster.prototype.tile = function(mapid, z, x, y, r, e, fn){
|
|
|
427
427
|
if (self.maps[mapid].versatiles) return self.versatile(tileurl, mapid, z, x, y, next);
|
|
428
428
|
self.fetchtile(tileurl, mapid, next);
|
|
429
429
|
|
|
430
|
-
})(function(err, tilestream
|
|
430
|
+
})(function(err, tilestream){
|
|
431
431
|
|
|
432
432
|
if (err) {
|
|
433
433
|
if (stream !== null) {
|
|
@@ -552,11 +552,17 @@ tileblaster.prototype.fetchtile = function(tileurl, mapid, fn){
|
|
|
552
552
|
// get versatile
|
|
553
553
|
tileblaster.prototype.versatile = function(tileurl, mapid, z, x, y, fn) {
|
|
554
554
|
const self = this;
|
|
555
|
-
if (!
|
|
555
|
+
if (!versatiles) return fn(new Error("Missing dependency: versatiles"));
|
|
556
556
|
if (!self.maps[mapid].c) self.maps[mapid].c = versatiles(tileurl, { tms: !!self.maps[mapid].tms });
|
|
557
|
-
self.maps[mapid].c.getTile(z,x,y, function(err,
|
|
557
|
+
self.maps[mapid].c.getTile(z,x,y, function(err, buf){
|
|
558
558
|
if (err) return fn(err);
|
|
559
|
-
|
|
559
|
+
self.maps[mapid].c.decompress(self.maps[mapid].c.header.tile_precompression, buf, function(err, buf){
|
|
560
|
+
if (err) return fn(err);
|
|
561
|
+
var strm = new stream.PassThrough;
|
|
562
|
+
strm.write(buf);
|
|
563
|
+
strm.end();
|
|
564
|
+
return fn(null, strm);
|
|
565
|
+
});
|
|
560
566
|
});
|
|
561
567
|
return self;
|
|
562
568
|
};
|
|
@@ -639,8 +645,7 @@ tileblaster.prototype.compress = function(file, comp){
|
|
|
639
645
|
};
|
|
640
646
|
|
|
641
647
|
// stream multiplexer
|
|
642
|
-
tileblaster.prototype._mux = function(
|
|
643
|
-
var self = this;
|
|
648
|
+
tileblaster.prototype._mux = function(){
|
|
644
649
|
|
|
645
650
|
// create a passthrough stream for every callback argument
|
|
646
651
|
// call back with created stream
|
|
@@ -654,7 +659,7 @@ tileblaster.prototype._mux = function(fn){
|
|
|
654
659
|
return (new stream.Writable({
|
|
655
660
|
write: function(chunk, encoding, done) {
|
|
656
661
|
streams.forEach(function(stream){
|
|
657
|
-
stream.write(chunk);
|
|
662
|
+
stream.write(chunk, encoding);
|
|
658
663
|
});
|
|
659
664
|
done();
|
|
660
665
|
},
|
|
@@ -738,7 +743,6 @@ tileblaster.prototype._tileurl = function(mapid, z, x, y, r, e){
|
|
|
738
743
|
|
|
739
744
|
// transform parameters to filename
|
|
740
745
|
tileblaster.prototype._tilefile = function(mapid, z, x, y, r, e){
|
|
741
|
-
var self = this;
|
|
742
746
|
return (mapid+"/"+z.toFixed(0)+"/"+x.toFixed(0)+"/"+y.toFixed(0)+((!!r)?r:"")+"."+((e) ? e : ""));
|
|
743
747
|
};
|
|
744
748
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tileblaster",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "pretty fast optimizing & compressing tile caching proxy",
|
|
5
5
|
"main": "lib/tileblaster.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"homepage": "https://github.com/yetzt/tileblaster#readme",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"dur": "^0.0.3",
|
|
21
|
-
"klaw": "^
|
|
21
|
+
"klaw": "^3.0.0",
|
|
22
22
|
"minimist": "^1.2.8",
|
|
23
23
|
"node-watch": "^0.7.3",
|
|
24
24
|
"phin": "^3.7.0",
|
|
@@ -31,5 +31,11 @@
|
|
|
31
31
|
"nsa": "^0.2",
|
|
32
32
|
"pnck": "^1.0.1",
|
|
33
33
|
"versatiles": "^0.3.0"
|
|
34
|
-
}
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">= 10"
|
|
37
|
+
},
|
|
38
|
+
"os": [
|
|
39
|
+
"!win32"
|
|
40
|
+
]
|
|
35
41
|
}
|