@ipld/car 4.1.0 → 4.1.3

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.
@@ -19,7 +19,7 @@ describe('CarIndexer fromBytes()', () => {
19
19
  const indexer$1 = await indexer.CarIndexer.fromBytes(common.goCarV2Bytes);
20
20
  const roots = await indexer$1.getRoots();
21
21
  common.assert.strictEqual(roots.length, 1);
22
- common.assert(common.goCarV2Roots[0].equals(roots[0]));
22
+ common.assert.ok(common.goCarV2Roots[0].equals(roots[0]));
23
23
  common.assert.strictEqual(indexer$1.version, 2);
24
24
  const indexData = [];
25
25
  for await (const index of indexer$1) {
@@ -76,13 +76,13 @@ describe('CarReader fromBytes()', () => {
76
76
  const reader = await readerBrowser.CarReader.fromBytes(common.goCarV2Bytes);
77
77
  const roots = await reader.getRoots();
78
78
  common.assert.strictEqual(roots.length, 1);
79
- common.assert(common.goCarV2Roots[0].equals(roots[0]));
79
+ common.assert.ok(common.goCarV2Roots[0].equals(roots[0]));
80
80
  common.assert.strictEqual(reader.version, 2);
81
81
  for (const {cid} of common.goCarV2Index) {
82
82
  const block = await reader.get(cid);
83
83
  common.assert.isDefined(block);
84
84
  if (block) {
85
- common.assert(cid.equals(block.cid));
85
+ common.assert.ok(cid.equals(block.cid));
86
86
  let content;
87
87
  if (cid.code === dagPb__namespace.code) {
88
88
  content = dagPb__namespace.decode(block.bytes);
@@ -182,9 +182,9 @@ describe('CarWriter', () => {
182
182
  const rawBytes = await append(0);
183
183
  const pbBytes = await append(1);
184
184
  const cborBytes = await append(2);
185
- common.assert(rawBytes.length > 0);
186
- common.assert(pbBytes.length > 0);
187
- common.assert(cborBytes.length > 0);
185
+ common.assert.ok(rawBytes.length > 0);
186
+ common.assert.ok(pbBytes.length > 0);
187
+ common.assert.ok(cborBytes.length > 0);
188
188
  const reassembled = concatBytes([
189
189
  headerBytes,
190
190
  rawBytes,
@@ -35,7 +35,7 @@ function createEncoder(writer) {
35
35
  }
36
36
  },
37
37
  async close() {
38
- return writer.end();
38
+ await writer.end();
39
39
  }
40
40
  };
41
41
  }
@@ -34,7 +34,7 @@ function create() {
34
34
  ended = true;
35
35
  const drainer = makeDrainer();
36
36
  outWaitResolver();
37
- return drainer;
37
+ await drainer;
38
38
  }
39
39
  };
40
40
  const iterator = {
@@ -19,7 +19,7 @@ describe('CarIndexer fromBytes()', () => {
19
19
  const indexer$1 = await indexer.CarIndexer.fromBytes(common.goCarV2Bytes);
20
20
  const roots = await indexer$1.getRoots();
21
21
  common.assert.strictEqual(roots.length, 1);
22
- common.assert(common.goCarV2Roots[0].equals(roots[0]));
22
+ common.assert.ok(common.goCarV2Roots[0].equals(roots[0]));
23
23
  common.assert.strictEqual(indexer$1.version, 2);
24
24
  const indexData = [];
25
25
  for await (const index of indexer$1) {
@@ -76,13 +76,13 @@ describe('CarReader fromBytes()', () => {
76
76
  const reader$1 = await reader.CarReader.fromBytes(common.goCarV2Bytes);
77
77
  const roots = await reader$1.getRoots();
78
78
  common.assert.strictEqual(roots.length, 1);
79
- common.assert(common.goCarV2Roots[0].equals(roots[0]));
79
+ common.assert.ok(common.goCarV2Roots[0].equals(roots[0]));
80
80
  common.assert.strictEqual(reader$1.version, 2);
81
81
  for (const {cid} of common.goCarV2Index) {
82
82
  const block = await reader$1.get(cid);
83
83
  common.assert.isDefined(block);
84
84
  if (block) {
85
- common.assert(cid.equals(block.cid));
85
+ common.assert.ok(cid.equals(block.cid));
86
86
  let content;
87
87
  if (cid.code === dagPb__namespace.code) {
88
88
  content = dagPb__namespace.decode(block.bytes);
@@ -182,9 +182,9 @@ describe('CarWriter', () => {
182
182
  const rawBytes = await append(0);
183
183
  const pbBytes = await append(1);
184
184
  const cborBytes = await append(2);
185
- common.assert(rawBytes.length > 0);
186
- common.assert(pbBytes.length > 0);
187
- common.assert(cborBytes.length > 0);
185
+ common.assert.ok(rawBytes.length > 0);
186
+ common.assert.ok(pbBytes.length > 0);
187
+ common.assert.ok(cborBytes.length > 0);
188
188
  const reassembled = concatBytes([
189
189
  headerBytes,
190
190
  rawBytes,
@@ -24,7 +24,7 @@ describe('CarIndexer fromBytes()', () => {
24
24
  const indexer = await CarIndexer.fromBytes(goCarV2Bytes);
25
25
  const roots = await indexer.getRoots();
26
26
  assert.strictEqual(roots.length, 1);
27
- assert(goCarV2Roots[0].equals(roots[0]));
27
+ assert.ok(goCarV2Roots[0].equals(roots[0]));
28
28
  assert.strictEqual(indexer.version, 2);
29
29
  const indexData = [];
30
30
  for await (const index of indexer) {
@@ -68,13 +68,13 @@ describe('CarReader fromBytes()', () => {
68
68
  const reader = await CarReader.fromBytes(goCarV2Bytes);
69
69
  const roots = await reader.getRoots();
70
70
  assert.strictEqual(roots.length, 1);
71
- assert(goCarV2Roots[0].equals(roots[0]));
71
+ assert.ok(goCarV2Roots[0].equals(roots[0]));
72
72
  assert.strictEqual(reader.version, 2);
73
73
  for (const {cid} of goCarV2Index) {
74
74
  const block = await reader.get(cid);
75
75
  assert.isDefined(block);
76
76
  if (block) {
77
- assert(cid.equals(block.cid));
77
+ assert.ok(cid.equals(block.cid));
78
78
  let content;
79
79
  if (cid.code === dagPb.code) {
80
80
  content = dagPb.decode(block.bytes);
@@ -193,9 +193,9 @@ describe('CarWriter', () => {
193
193
  const rawBytes = await append(0);
194
194
  const pbBytes = await append(1);
195
195
  const cborBytes = await append(2);
196
- assert(rawBytes.length > 0);
197
- assert(pbBytes.length > 0);
198
- assert(cborBytes.length > 0);
196
+ assert.ok(rawBytes.length > 0);
197
+ assert.ok(pbBytes.length > 0);
198
+ assert.ok(cborBytes.length > 0);
199
199
  const reassembled = concatBytes([
200
200
  headerBytes,
201
201
  rawBytes,
@@ -26,7 +26,7 @@ function createEncoder(writer) {
26
26
  }
27
27
  },
28
28
  async close() {
29
- return writer.end();
29
+ await writer.end();
30
30
  }
31
31
  };
32
32
  }
@@ -30,7 +30,7 @@ export function create() {
30
30
  ended = true;
31
31
  const drainer = makeDrainer();
32
32
  outWaitResolver();
33
- return drainer;
33
+ await drainer;
34
34
  }
35
35
  };
36
36
  const iterator = {
@@ -24,7 +24,7 @@ describe('CarIndexer fromBytes()', () => {
24
24
  const indexer = await CarIndexer.fromBytes(goCarV2Bytes);
25
25
  const roots = await indexer.getRoots();
26
26
  assert.strictEqual(roots.length, 1);
27
- assert(goCarV2Roots[0].equals(roots[0]));
27
+ assert.ok(goCarV2Roots[0].equals(roots[0]));
28
28
  assert.strictEqual(indexer.version, 2);
29
29
  const indexData = [];
30
30
  for await (const index of indexer) {
@@ -68,13 +68,13 @@ describe('CarReader fromBytes()', () => {
68
68
  const reader = await CarReader.fromBytes(goCarV2Bytes);
69
69
  const roots = await reader.getRoots();
70
70
  assert.strictEqual(roots.length, 1);
71
- assert(goCarV2Roots[0].equals(roots[0]));
71
+ assert.ok(goCarV2Roots[0].equals(roots[0]));
72
72
  assert.strictEqual(reader.version, 2);
73
73
  for (const {cid} of goCarV2Index) {
74
74
  const block = await reader.get(cid);
75
75
  assert.isDefined(block);
76
76
  if (block) {
77
- assert(cid.equals(block.cid));
77
+ assert.ok(cid.equals(block.cid));
78
78
  let content;
79
79
  if (cid.code === dagPb.code) {
80
80
  content = dagPb.decode(block.bytes);
@@ -193,9 +193,9 @@ describe('CarWriter', () => {
193
193
  const rawBytes = await append(0);
194
194
  const pbBytes = await append(1);
195
195
  const cborBytes = await append(2);
196
- assert(rawBytes.length > 0);
197
- assert(pbBytes.length > 0);
198
- assert(cborBytes.length > 0);
196
+ assert.ok(rawBytes.length > 0);
197
+ assert.ok(pbBytes.length > 0);
198
+ assert.ok(cborBytes.length > 0);
199
199
  const reassembled = concatBytes([
200
200
  headerBytes,
201
201
  rawBytes,
package/lib/encoder.js CHANGED
@@ -59,7 +59,7 @@ function createEncoder (writer) {
59
59
  * @returns {Promise<void>}
60
60
  */
61
61
  async close () {
62
- return writer.end()
62
+ await writer.end()
63
63
  /* c8 ignore next 2 */
64
64
  // Node.js 12 c8 bug
65
65
  }
@@ -52,7 +52,7 @@ export function create () {
52
52
  ended = true
53
53
  const drainer = makeDrainer()
54
54
  outWaitResolver()
55
- return drainer
55
+ await drainer
56
56
  /* c8 ignore next 2 */
57
57
  // Node.js 12 c8 bug
58
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ipld/car",
3
- "version": "4.1.0",
3
+ "version": "4.1.3",
4
4
  "description": "Content Addressable aRchive format reader and writer",
5
5
  "main": "./cjs/car.js",
6
6
  "types": "./types/car.d.ts",
@@ -91,10 +91,10 @@
91
91
  "ipjs": "^5.2.0",
92
92
  "ipld-garbage": "^4.0.10",
93
93
  "jsdoc4readme": "^1.4.0",
94
- "mocha": "^9.1.3",
95
- "polendina": "~2.0.1",
96
- "standard": "^16.0.4",
97
- "typescript": "~4.6.2"
94
+ "mocha": "^10.0.0",
95
+ "polendina": "~3.1.0",
96
+ "standard": "^17.0.0",
97
+ "typescript": "~4.7.2"
98
98
  },
99
99
  "standard": {
100
100
  "ignore": [
@@ -30,7 +30,7 @@ describe('CarIndexer fromBytes()', () => {
30
30
  const indexer = await CarIndexer.fromBytes(goCarV2Bytes)
31
31
  const roots = await indexer.getRoots()
32
32
  assert.strictEqual(roots.length, 1)
33
- assert(goCarV2Roots[0].equals(roots[0]))
33
+ assert.ok(goCarV2Roots[0].equals(roots[0]))
34
34
  assert.strictEqual(indexer.version, 2)
35
35
 
36
36
  const indexData = []
@@ -65,13 +65,13 @@ describe('CarReader fromBytes()', () => {
65
65
  const reader = await CarReader.fromBytes(goCarV2Bytes)
66
66
  const roots = await reader.getRoots()
67
67
  assert.strictEqual(roots.length, 1)
68
- assert(goCarV2Roots[0].equals(roots[0]))
68
+ assert.ok(goCarV2Roots[0].equals(roots[0]))
69
69
  assert.strictEqual(reader.version, 2)
70
70
  for (const { cid } of goCarV2Index) {
71
71
  const block = await reader.get(cid)
72
72
  assert.isDefined(block)
73
73
  if (block) {
74
- assert(cid.equals(block.cid))
74
+ assert.ok(cid.equals(block.cid))
75
75
  let content
76
76
  if (cid.code === dagPb.code) {
77
77
  content = dagPb.decode(block.bytes)
@@ -265,9 +265,9 @@ describe('CarWriter', () => {
265
265
  const pbBytes = await append(1)
266
266
  const cborBytes = await append(2)
267
267
 
268
- assert(rawBytes.length > 0)
269
- assert(pbBytes.length > 0)
270
- assert(cborBytes.length > 0)
268
+ assert.ok(rawBytes.length > 0)
269
+ assert.ok(pbBytes.length > 0)
270
+ assert.ok(cborBytes.length > 0)
271
271
 
272
272
  const reassembled = concatBytes([headerBytes, rawBytes, pbBytes, cborBytes])
273
273