@@ -3,9 +3,9 @@ import { json_decode_object, json_encode_object } from "./util.js";
3
3
import type {
4
4
ArrayMetadata ,
5
5
ArrayMetadataV2 ,
6
+ Attributes ,
6
7
GroupMetadata ,
7
8
GroupMetadataV2 ,
8
- Attributes ,
9
9
} from "./metadata.js" ;
10
10
11
11
type ConsolidatedMetadata = {
@@ -65,7 +65,9 @@ export async function withConsolidated<Store extends Readable>(
65
65
. catch ( ( ) => ( { } ) ) ;
66
66
67
67
return {
68
- async get ( ...args : Parameters < Store [ "get" ] > ) : Promise < Uint8Array | undefined > {
68
+ async get (
69
+ ...args : Parameters < Store [ "get" ] >
70
+ ) : Promise < Uint8Array | undefined > {
69
71
let [ key , opts ] = args ;
70
72
if ( known_meta [ key ] ) {
71
73
return json_encode_object ( known_meta [ key ] ) ;
@@ -78,19 +80,18 @@ export async function withConsolidated<Store extends Readable>(
78
80
return maybe_bytes ;
79
81
} ,
80
82
contents ( ) : { path : AbsolutePath ; kind : "array" | "group" } [ ] {
81
- let contents : { path : AbsolutePath , kind : "array" | "group" } [ ] = [ ] ;
83
+ let contents : { path : AbsolutePath ; kind : "array" | "group" } [ ] = [ ] ;
82
84
for ( let [ key , value ] of Object . entries ( known_meta ) ) {
83
85
let parts = key . split ( "/" ) ;
84
86
let filename = parts . pop ( ) ! ;
85
- let path = parts . join ( "/" ) as AbsolutePath ;
86
- if ( ! path . startsWith ( "/" ) ) path = `/${ path } ` ;
87
+ let path = ( parts . join ( "/" ) || "/" ) as AbsolutePath ;
87
88
if ( filename === ".zarray" ) contents . push ( { path, kind : "array" } ) ;
88
89
if ( filename === ".zgroup" ) contents . push ( { path, kind : "group" } ) ;
89
90
if ( is_v3 ( value ) ) {
90
91
contents . push ( { path, kind : value . node_type } ) ;
91
92
}
92
93
}
93
94
return contents ;
94
- }
95
+ } ,
95
96
} ;
96
97
}
0 commit comments