Skip to content

Commit ddc62bf

Browse files
committed
feat: switch to chunkd v7 which uses a dataview based interface
1 parent d773c6b commit ddc62bf

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"cotar": "./bin/cotar"
88
},
99
"dependencies": {
10-
"@chunkd/source-file": "^4.5.1",
10+
"@chunkd/source-file": "^7.2.2",
1111
"@cotar/core": "^4.0.0",
1212
"@oclif/command": "^1.8.0",
1313
"binparse": "^1.1.0",

packages/core/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ For example `@cotar/core` can fetch a 1KB file from a 100GB tar file with only 1
1212
To fetch a single tile, the index has to be loaded into memory then the cotar object provides a `get(fileName)` interface to access any file inside the tar
1313
```typescript
1414
import { Cotar, CotarIndexBinary } from '@cotar/core';
15-
import { SourceAwsS3 } from '@chunkd/source-aws'
15+
import { fsa } from '@chunkd/fs'
1616

17-
const source = SourceAwsS3.fromUri('s3://linz-basemaps/topographic.tar');
17+
const source = fsa.source('s3://linz-basemaps/topographic.tar');
1818
const cotar = Cotar.fromTar(source);
1919

2020
// Fetch a gzipped PBF file from a tar

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"types": "build/src/index.d.ts",
66
"license": "MIT",
77
"dependencies": {
8-
"@chunkd/core": "^4.5.1",
8+
"@chunkd/core": "^7.2.2",
99
"@sindresorhus/fnv1a": "^2.0.1",
1010
"binparse": "^1.1.0"
1111
},
@@ -18,7 +18,7 @@
1818
"*.png"
1919
],
2020
"devDependencies": {
21-
"@chunkd/source-file": "^4.5.1",
22-
"@types/node": "^16.4.1"
21+
"@chunkd/source-file": "^7.2.2",
22+
"@types/node": "^15.12.1"
2323
}
2424
}

packages/core/src/binary/binary.index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChunkSource, LogType } from '@chunkd/core';
1+
import { LogType, ChunkSource } from '@chunkd/core';
22
import fnv1a from '@sindresorhus/fnv1a';
33
import { bp, StrutInfer } from 'binparse';
44
import { CotarIndexRecord } from '../cotar';
@@ -77,13 +77,13 @@ export class CotarIndex {
7777
while (true) {
7878
const offset = this.sourceOffset + index * IndexRecordSize + IndexHeaderSize;
7979
await this.source.loadBytes(offset, IndexRecordSize, logger);
80-
startHash = this.source.bigUint64(offset);
80+
startHash = this.source.getBigUint64(offset);
8181

8282
// Found the file
8383
if (startHash === hash) {
84-
const fileOffset = this.source.bigUint64(offset + 8);
85-
const fileSize = this.source.bigUint64(offset + 16);
86-
return { offset: toNumber(fileOffset), size: toNumber(fileSize) };
84+
const fileOffset = this.source.getUint64(offset + 8);
85+
const fileSize = this.source.getUint64(offset + 16);
86+
return { offset: fileOffset, size: fileSize };
8787
}
8888
// Found a gap in the hash table (file doesnt exist)
8989
if (startHash === Big0) return null;

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@
3030
chalk "^2.0.0"
3131
js-tokens "^4.0.0"
3232

33-
"@chunkd/core@^4.5.1":
34-
version "4.5.1"
35-
resolved "https://registry.yarnpkg.com/@chunkd/core/-/core-4.5.1.tgz#179d0f0e035a9af7c56ec4d88c01e9f4bc9b7a32"
36-
integrity sha512-8gZGvWD8yYWysvbrLla1uubYvgm+PQrzEdHSK8gMwtgJTULg3GOVpIUzFTFmxDdR2CjwKhdb1BD69NZbVoVI/Q==
33+
"@chunkd/core@^7.2.2":
34+
version "7.2.2"
35+
resolved "https://registry.yarnpkg.com/@chunkd/core/-/core-7.2.2.tgz#fc561df415f5f07ddec92f79b472803be753b439"
36+
integrity sha512-OhPXkl4UvQDy2CCGj6rKKDuxwY4OyAmsCtsJ84dQXcgTOER9aVf6DR++ydPc2OfMwcBNmE8ZFpgEW9OUM07wNA==
3737

38-
"@chunkd/source-file@^4.5.1":
39-
version "4.5.1"
40-
resolved "https://registry.yarnpkg.com/@chunkd/source-file/-/source-file-4.5.1.tgz#c5971adad64b21c1c5b9f74790f0fb33c9b54a78"
41-
integrity sha512-LBv6rFgyDpUboJoCZZRwzzpRPcw2oNGm97LKRhOQl9Fu4QX4bGS1UEn82sddbu2nA278+pi4yKwvsGavDcBgXQ==
38+
"@chunkd/source-file@^7.2.2":
39+
version "7.2.2"
40+
resolved "https://registry.yarnpkg.com/@chunkd/source-file/-/source-file-7.2.2.tgz#c05c255b52f316aab95a7e930b2665dac2042253"
41+
integrity sha512-OznggHr3BVvuDwqxErA34jHWkDqMF8kqJ1l6K3mkR9jTSPd7LSKaiaxJZhIHp0G1SBOaS8gZ7WEXON5mcC7wMw==
4242
dependencies:
43-
"@chunkd/core" "^4.5.1"
43+
"@chunkd/core" "^7.2.2"
4444

4545
"@eslint/eslintrc@^0.4.3":
4646
version "0.4.3"

0 commit comments

Comments
 (0)