@versatiles/container 1.2.1 → 1.2.2
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/README.md +8 -8
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/lib/decompress.d.ts +0 -1
- package/dist/lib/interfaces.d.ts +0 -1
- package/dist/lib/reader_http.js +1 -2
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -5,12 +5,12 @@ A client library for [VersaTiles containers](https://github.com/versatiles-org/v
|
|
|
5
5
|
|
|
6
6
|
# Install
|
|
7
7
|
|
|
8
|
-
`npm i @versatiles/container
|
|
8
|
+
`npm i @versatiles/container`
|
|
9
9
|
|
|
10
10
|
# Usage Example
|
|
11
11
|
|
|
12
12
|
```js
|
|
13
|
-
import VersaTiles from '@versatiles/container
|
|
13
|
+
import VersaTiles from '@versatiles/container';
|
|
14
14
|
import fs from 'fs';
|
|
15
15
|
|
|
16
16
|
const container = new VersaTiles('https://example.org/planet.versatiles');
|
|
@@ -28,11 +28,11 @@ fs.writeFileSync('tile.' + header.tile_format, tile);
|
|
|
28
28
|
### Class: `Container`<a id="class_container"></a>
|
|
29
29
|
|
|
30
30
|
The `VersaTiles` class is a wrapper around a `.versatiles` container file. It provides methods\
|
|
31
|
-
to access tile data, metadata, and other properties within the container. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
31
|
+
to access tile data, metadata, and other properties within the container. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/b2d8999879a78431b230a775ba91e1b589ce6f64/src/index.ts#L38">\[src]</a></sup>
|
|
32
32
|
|
|
33
33
|
#### Constructor: `new Container(source, options)`
|
|
34
34
|
|
|
35
|
-
Constructs a new instance of the VersaTiles class. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
35
|
+
Constructs a new instance of the VersaTiles class. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/b2d8999879a78431b230a775ba91e1b589ce6f64/src/index.ts#L59">\[src]</a></sup>
|
|
36
36
|
|
|
37
37
|
**Parameters:**
|
|
38
38
|
|
|
@@ -44,7 +44,7 @@ Constructs a new instance of the VersaTiles class. <sup><a href="https://github.
|
|
|
44
44
|
|
|
45
45
|
#### Method: `getHeader()`
|
|
46
46
|
|
|
47
|
-
Asynchronously retrieves the header information from the `.versatiles` container. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
47
|
+
Asynchronously retrieves the header information from the `.versatiles` container. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/b2d8999879a78431b230a775ba91e1b589ce6f64/src/index.ts#L81">\[src]</a></sup>
|
|
48
48
|
|
|
49
49
|
**Returns:** <code>Promise<[Header](#interface_header)></code>
|
|
50
50
|
|
|
@@ -52,7 +52,7 @@ Asynchronously retrieves the header information from the `.versatiles` container
|
|
|
52
52
|
|
|
53
53
|
Asynchronously retrieves the metadata associated with the `.versatiles` container.\
|
|
54
54
|
Metadata typically includes information about `vector_layers` for vector tiles.
|
|
55
|
-
If the container does not include metadata, this method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
55
|
+
If the container does not include metadata, this method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/b2d8999879a78431b230a775ba91e1b589ce6f64/src/index.ts#L128">\[src]</a></sup>
|
|
56
56
|
|
|
57
57
|
**Returns:** <code>Promise\<undefined | string></code>
|
|
58
58
|
|
|
@@ -61,7 +61,7 @@ If the container does not include metadata, this method returns `null`. <sup><a
|
|
|
61
61
|
Asynchronously retrieves a specific tile's data as a Buffer. If the tile data is compressed as\
|
|
62
62
|
defined in the container header, the returned Buffer will contain the compressed data.
|
|
63
63
|
To obtain uncompressed data, use the `getTileUncompressed` method.
|
|
64
|
-
If the specified tile does not exist, the method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
64
|
+
If the specified tile does not exist, the method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/b2d8999879a78431b230a775ba91e1b589ce6f64/src/index.ts#L155">\[src]</a></sup>
|
|
65
65
|
|
|
66
66
|
**Parameters:**
|
|
67
67
|
|
|
@@ -79,7 +79,7 @@ If the specified tile does not exist, the method returns `null`. <sup><a href="h
|
|
|
79
79
|
Asynchronously retrieves a specific tile's uncompressed data as a Buffer. This method first\
|
|
80
80
|
retrieves the compressed tile data using `getTile` and then decompresses it based on the
|
|
81
81
|
compression setting in the container header.
|
|
82
|
-
If the specified tile does not exist, the method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
82
|
+
If the specified tile does not exist, the method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/b2d8999879a78431b230a775ba91e1b589ce6f64/src/index.ts#L203">\[src]</a></sup>
|
|
83
83
|
|
|
84
84
|
**Parameters:**
|
|
85
85
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -224,7 +224,6 @@ export class Container {
|
|
|
224
224
|
// build map
|
|
225
225
|
this.#blockIndex = new Map(blocks.map(b => [`${b.level},${b.column},${b.row}`, b]));
|
|
226
226
|
return this.#blockIndex;
|
|
227
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
228
227
|
function addBlock(buffer, blockOffset, tileIndexOffset, tileIndexLength) {
|
|
229
228
|
const block = {
|
|
230
229
|
level: buffer.readUInt8(0),
|
package/dist/lib/decompress.d.ts
CHANGED
package/dist/lib/interfaces.d.ts
CHANGED
package/dist/lib/reader_http.js
CHANGED
|
@@ -34,7 +34,6 @@ export default function getHTTPReader(url) {
|
|
|
34
34
|
throw new RangeError(`Invalid read length: ${length}. The read length must be a non-negative integer.`);
|
|
35
35
|
}
|
|
36
36
|
const headers = {
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
38
37
|
'user-agent': 'Mozilla/5.0 (compatible; versatiles; +https://www.npmjs.com/package/versatiles)',
|
|
39
38
|
'range': `bytes=${position}-${position + length - 1}`,
|
|
40
39
|
};
|
|
@@ -70,7 +69,7 @@ export default function getHTTPReader(url) {
|
|
|
70
69
|
const contentRange = message.headers['content-range'];
|
|
71
70
|
if (contentRange == null)
|
|
72
71
|
throw Error('The response header does not contain "content-range"');
|
|
73
|
-
const parts = /^bytes (\d+)
|
|
72
|
+
const parts = /^bytes (\d+)-(\d+)\/(\d+)/i.exec(contentRange);
|
|
74
73
|
if (parts == null)
|
|
75
74
|
throw Error('"content-range" in response header is malformed');
|
|
76
75
|
if (position !== parseInt(parts[1], 10))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versatiles/container",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "A client library for reading VersaTiles containers",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
@@ -49,17 +49,18 @@
|
|
|
49
49
|
"versatiles"
|
|
50
50
|
],
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/jest": "^29.5.
|
|
53
|
-
"@types/node": "^
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
55
|
-
"@typescript-eslint/parser": "^
|
|
56
|
-
"@versatiles/release-tool": "^1.2.
|
|
57
|
-
"eslint": "^
|
|
52
|
+
"@types/jest": "^29.5.13",
|
|
53
|
+
"@types/node": "^22.5.5",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^8.6.0",
|
|
55
|
+
"@typescript-eslint/parser": "^8.6.0",
|
|
56
|
+
"@versatiles/release-tool": "^1.2.6",
|
|
57
|
+
"eslint": "^9.11.0",
|
|
58
58
|
"jest": "^29.7.0",
|
|
59
|
-
"npm-check-updates": "^
|
|
60
|
-
"ts-jest": "^29.
|
|
59
|
+
"npm-check-updates": "^17.1.3",
|
|
60
|
+
"ts-jest": "^29.2.5",
|
|
61
61
|
"ts-node": "^10.9.2",
|
|
62
|
-
"tsx": "^4.
|
|
63
|
-
"typescript": "^5.
|
|
62
|
+
"tsx": "^4.19.1",
|
|
63
|
+
"typescript": "^5.6.2",
|
|
64
|
+
"typescript-eslint": "^8.6.0"
|
|
64
65
|
}
|
|
65
66
|
}
|