Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
Fixed example code in README
· 3b65d3cb
BytesNZ
authored
Jun 02, 2022
3b65d3cb
Update repo-utils
· 200e2ffb
BytesNZ
authored
Jun 02, 2022
200e2ffb
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
200e2ffb
...
...
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on
[
Keep a Changelog
](
http://keepachangelog.com/en/1.0.0/
)
and this project adheres to
[
Semantic Versioning
](
http://semver.org/spec/v2.0.0.html
)
.
## [0.1.1] - 2022-06-02
### Fixed
-
Fixed example code in README
## [0.1.0] - 2022-06-02
### Added
...
...
@@ -12,5 +18,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
-
Basic tile cache downloading
-
Basic middleware
[
0.
2.0
]:
https://gitlab.com/bytesnz/tile-cacher/compare/v0.1.0...v0.
2.0
[
0.
1.1
]:
https://gitlab.com/bytesnz/tile-cacher/compare/v0.1.0...v0.
1.1
[
0.1.0
]:
https://gitlab.com/bytesnz/tile-cacher/tree/v0.1.0
README.md
View file @
200e2ffb
# tile-cacher 0.1.
0
# tile-cacher 0.1.
1
Node express-like middleware and downloader for map tile caches
[
![pipeline status
](
https://gitlab.com/bytesnz/tile-cacher/badges/main/pipeline.svg
)
](https://gitlab.com/bytesnz/tile-cacher/commits/main)
[
![tile-cacher on NPM
](
https://bytes.nz/b/tile-cacher/npm
)
](https://npmjs.com/package/tile-cacher)
[
![license
](
https://bytes.nz/b/tile-cacher/custom?color=yellow&name=license&value=GPL-3.0
)
](https://gitlab.com/bytesnz/tile-cacher/blob/main/LICENSE)
[
![developtment time
](
https://bytes.nz/b/tile-cacher/custom?color=yellowgreen&name=development+time&value=~8+hours
)
](https://gitlab.com/bytesnz/tile-cacher/blob/main/.tickings)
[
![contributor covenant
](
https://bytes.nz/b/tile-cacher/custom?color=purple&name=contributor+covenant&value=v1.4.1+adopted
)
](https://gitlab.com/bytesnz/tile-cacher/blob/main/CODE_OF_CONDUCT.md)
...
...
@@ -17,7 +18,7 @@ schedule the next check inline with the `checkInterval` option.
### Example
####
*
examples/middleware.js
*
####
_
examples/middleware.js
_
```
js
import
{
createReadStream
}
from
'
fs
'
;
...
...
@@ -31,25 +32,26 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
const
app
=
polka
();
app
.
get
(
'
/
'
,
(
req
,
res
)
=
&
gt
;
{
const
stream
=
createReadStream
(
join
(
__dirname
,
'
index.html
'
));
res
.
setHeader
(
'
Content-Type
'
,
'
text/html
'
);
stream
.
pipe
(
res
);
app
.
get
(
'
/
'
,
(
req
,
res
)
=
>
{
const
stream
=
createReadStream
(
join
(
__dirname
,
'
index.html
'
));
res
.
setHeader
(
'
Content-Type
'
,
'
text/html
'
);
stream
.
pipe
(
res
);
});
app
.
get
(
'
/tiles/:id/:z/:x/:y.png
'
,
middleware
(
options
));
app
.
listen
(
3001
,
()
=
&
gt
;
{
console
.
log
(
'
tile-cacher middleware listening on port 3001
'
);
app
.
listen
(
3001
,
()
=
>
{
console
.
log
(
'
tile-cacher middleware listening on port 3001
'
);
});
```
</details>
## Tile Cache Check
### Example
####
*
examples/cacheCheck.js
*
####
_
examples/cacheCheck.js
_
```
js
import
{
checkCache
}
from
'
tile-cacher
'
;
...
...
@@ -65,46 +67,46 @@ Options are the same for both the middlware and the cacheCheck functionality
### Example
####
*
examples/options.js
*
####
_
examples/options.js
_
```
js
export
const
options
=
{
servers
:
[
{
id
:
'
opentopomap
'
,
url
:
'
https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png
'
,
activelyCache
:
[
{
northLat
:
-
40.975513
,
southLat
:
-
41.100311
,
westLon
:
174.994183
,
eastLon
:
175.148163
,
maxZoom
:
13
}
],
cache
:
[
{
northLat
:
-
39.975513
,
southLat
:
-
42.100311
,
westLon
:
173.994183
,
eastLon
:
176.148163
,
maxZoom
:
13
}
],
age
:
168
}
],
checkInterval
:
20
,
downloadWaitTime
:
1000
,
extension
:
'
png
'
,
folder
:
'
cache
'
,
logger
:
{
log
:
(...
args
)
=
&
gt
;
console
.
log
(
new
Date
().
toISOString
(),
'
LOG
'
,
...
args
),
warn
:
(...
args
)
=
&
gt
;
console
.
warn
(
new
Date
().
toISOString
(),
'
WARN
'
,
...
args
),
debug
:
(...
args
)
=
&
gt
;
console
.
debug
(
new
Date
().
toISOString
(),
'
DEBUG
'
,
...
args
),
info
:
(...
args
)
=
&
gt
;
console
.
info
(
new
Date
().
toISOString
(),
'
INFO
'
,
...
args
),
error
:
(...
args
)
=
&
gt
;
console
.
error
(
new
Date
().
toISOString
(),
'
ERROR
'
,
...
args
)
}
servers
:
[
{
id
:
'
opentopomap
'
,
url
:
'
https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png
'
,
activelyCache
:
[
{
northLat
:
-
40.975513
,
southLat
:
-
41.100311
,
westLon
:
174.994183
,
eastLon
:
175.148163
,
maxZoom
:
13
}
],
cache
:
[
{
northLat
:
-
39.975513
,
southLat
:
-
42.100311
,
westLon
:
173.994183
,
eastLon
:
176.148163
,
maxZoom
:
13
}
],
age
:
168
}
],
checkInterval
:
20
,
downloadWaitTime
:
1000
,
extension
:
'
png
'
,
folder
:
'
cache
'
,
logger
:
{
log
:
(...
args
)
=
>
console
.
log
(
new
Date
().
toISOString
(),
'
LOG
'
,
...
args
),
warn
:
(...
args
)
=
>
console
.
warn
(
new
Date
().
toISOString
(),
'
WARN
'
,
...
args
),
debug
:
(...
args
)
=
>
console
.
debug
(
new
Date
().
toISOString
(),
'
DEBUG
'
,
...
args
),
info
:
(...
args
)
=
>
console
.
info
(
new
Date
().
toISOString
(),
'
INFO
'
,
...
args
),
error
:
(...
args
)
=
>
console
.
error
(
new
Date
().
toISOString
(),
'
ERROR
'
,
...
args
)
}
};
```
...
...
@@ -130,6 +132,12 @@ All notable changes to this project will be documented in this file.
The format is based on
[
Keep a Changelog
](
http://keepachangelog.com/en/1.0.0/
)
and this project adheres to
[
Semantic Versioning
](
http://semver.org/spec/v2.0.0.html
)
.
## [0.1.1] - 2022-06-02
### Fixed
-
Fixed example code in README
## [0.1.0] - 2022-06-02
### Added
...
...
@@ -137,7 +145,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
-
Basic tile cache downloading
-
Basic middleware
[
0.
2.0
]:
https://gitlab.com/bytesnz/tile-cacher/compare/v0.1.0...v0.
2.0
[
0.
1.1
]:
https://gitlab.com/bytesnz/tile-cacher/compare/v0.1.0...v0.
1.1
[
0.1.0
]:
https://gitlab.com/bytesnz/tile-cacher/tree/v0.1.0
...
...
package.json
View file @
200e2ffb
{
"name"
:
"tile-cacher"
,
"version"
:
"0.1.
0
"
,
"version"
:
"0.1.
1
"
,
"description"
:
"Map tile cacher middleware"
,
"main"
:
"index.js"
,
"type"
:
"module"
,
...
...
repo-utils
@
c251dbf0
Compare
65692987
...
c251dbf0
Subproject commit
65692987ff7095d94f3080fc8a1c550ce80e88f9
Subproject commit
c251dbf038a825f07edefc93fbeb70c3281de2ce
src/README.md
View file @
200e2ffb
...
...
@@ -3,6 +3,7 @@
Node express-like middleware and downloader for map tile caches
[
![pipeline status
](
https://gitlab.com/bytesnz/tile-cacher/badges/main/pipeline.svg
)
](https://gitlab.com/bytesnz/tile-cacher/commits/main)
[
![tile-cacher on NPM
](
https://bytes.nz/b/tile-cacher/npm
)
](https://npmjs.com/package/tile-cacher)
[
![license
](
https://bytes.nz/b/tile-cacher/custom?color=yellow&name=license&value=GPL-3.0
)
](https://gitlab.com/bytesnz/tile-cacher/blob/main/LICENSE)
[
![developtment time
](
https://bytes.nz/b/tile-cacher/custom?color=yellowgreen&name=development+time&value=~8+hours
)
](https://gitlab.com/bytesnz/tile-cacher/blob/main/.tickings)
[
![contributor covenant
](
https://bytes.nz/b/tile-cacher/custom?color=purple&name=contributor+covenant&value=v1.4.1+adopted
)
](https://gitlab.com/bytesnz/tile-cacher/blob/main/CODE_OF_CONDUCT.md)
...
...
@@ -20,7 +21,7 @@ schedule the next check inline with the `checkInterval` option.
#### _examples/middleware.js_
```
js
<!=
examples
/
middleware
.
js
>
<!=
!
examples
/
middleware
.
js
>
```
</details>
...
...
@@ -32,7 +33,7 @@ schedule the next check inline with the `checkInterval` option.
#### _examples/cacheCheck.js_
```
js
<!=
examples
/
cacheCheck
.
js
>
<!=
!
examples
/
cacheCheck
.
js
>
```
## Options
...
...
@@ -44,7 +45,7 @@ Options are the same for both the middlware and the cacheCheck functionality
#### _examples/options.js_
```
js
<!=
examples
/
options
.
js
>
<!=
!
examples
/
options
.
js
>
```
## Development
...
...