@versatiles/container 1.2.0 → 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 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/67a9864/src/index.ts#L38">\[src]</a></sup>
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/67a9864/src/index.ts#L59">\[src]</a></sup>
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/67a9864/src/index.ts#L81">\[src]</a></sup>
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/67a9864/src/index.ts#L128">\[src]</a></sup>
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/67a9864/src/index.ts#L155">\[src]</a></sup>
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/67a9864/src/index.ts#L203">\[src]</a></sup>
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
@@ -1,6 +1,5 @@
1
- /// <reference types="node" />
2
- import type { Block, Header, OpenOptions, Reader, TileIndex } from './lib/interfaces';
3
- export type { Compression, Format, Header, OpenOptions, Reader } from './lib/interfaces';
1
+ import type { Block, Header, OpenOptions, Reader, TileIndex } from './lib/interfaces.js';
2
+ export type { Compression, Format, Header, OpenOptions, Reader } from './lib/interfaces.js';
4
3
  /**
5
4
  * The `VersaTiles` class is a wrapper around a `.versatiles` container file. It provides methods
6
5
  * to access tile data, metadata, and other properties within the container.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import HttpReader from './lib/reader_http';
2
- import FileReader from './lib/reader_file';
3
- import { decompress } from './lib/decompress';
1
+ import HttpReader from './lib/reader_http.js';
2
+ import FileReader from './lib/reader_file.js';
3
+ import { decompress } from './lib/decompress.js';
4
4
  const FORMATS = {
5
5
  'c01': ['png', 'jpg', 'webp', null, null, null, null, null, null, null, null, null, null, null, null, null, 'pbf'],
6
6
  'v01': ['png', 'jpg', 'webp', 'pbf'],
@@ -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),
@@ -1,5 +1,4 @@
1
- /// <reference types="node" />
2
- import type { Compression } from './interfaces';
1
+ import type { Compression } from './interfaces.js';
3
2
  /**
4
3
  * Decompresses a buffer using the specified compression algorithm. Currently supports 'br' for Brotli and 'gzip' for GZIP.
5
4
  * If the specified algorithm is not supported, the function resolves the promise with the original buffer.
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Supported compression.
4
3
  * `null` signifies that the data is uncompressed.
@@ -1,4 +1,4 @@
1
- import type { Reader } from './interfaces';
1
+ import type { Reader } from './interfaces.js';
2
2
  /**
3
3
  * Creates a file reader function for reading chunks of data from a file. This reader abstracts
4
4
  * the file reading process and provides a simple async interface to read data from the specified file.
@@ -1,4 +1,4 @@
1
- import type { Reader } from './interfaces';
1
+ import type { Reader } from './interfaces.js';
2
2
  /**
3
3
  * Creates a function capable of reading data from a specified URL, which can be used
4
4
  * to read data chunks in an HTTP GET request. This is particularly useful for
@@ -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+)\-(\d+)\/(\d+)/i.exec(contentRange);
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.0",
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",
@@ -19,9 +19,9 @@
19
19
  ],
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "git+https://github.com/versatiles-org/node-versatiles.git"
22
+ "url": "git+https://github.com/versatiles-org/node-versatiles-container.git"
23
23
  },
24
- "homepage": "https://github.com/versatiles-org/node-versatiles/blob/main/versatiles-container/README.md",
24
+ "homepage": "https://github.com/versatiles-org/node-versatiles-container/blob/main/versatiles-container/README.md",
25
25
  "main": "dist/index.js",
26
26
  "types": "dist/index.d.ts",
27
27
  "type": "module",
@@ -49,17 +49,18 @@
49
49
  "versatiles"
50
50
  ],
51
51
  "devDependencies": {
52
- "@types/jest": "^29.5.12",
53
- "@types/node": "^20.11.20",
54
- "@typescript-eslint/eslint-plugin": "^7.0.2",
55
- "@typescript-eslint/parser": "^7.0.2",
56
- "@versatiles/release-tool": "^1.2.2",
57
- "eslint": "^8.57.0",
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": "^16.14.15",
60
- "ts-jest": "^29.1.2",
59
+ "npm-check-updates": "^17.1.3",
60
+ "ts-jest": "^29.2.5",
61
61
  "ts-node": "^10.9.2",
62
- "tsx": "^4.7.1",
63
- "typescript": "^5.3.3"
62
+ "tsx": "^4.19.1",
63
+ "typescript": "^5.6.2",
64
+ "typescript-eslint": "^8.6.0"
64
65
  }
65
66
  }