File tree Expand file tree Collapse file tree 3 files changed +17
-16
lines changed
Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -393,7 +393,9 @@ export async function filterUselessFileInits(
393393
394394 for ( let i = 0 ; i < batch . length ; i ++ ) {
395395 if ( ! results [ i ] ) {
396- throw new Error ( `Could not retrieve totalChunk data entry for file ${ batch [ i ] . preStore . location } ` ) ;
396+ throw new Error (
397+ `Could not retrieve totalChunk data entry for file ${ batch [ i ] . preStore . location } `
398+ )
397399 }
398400 if (
399401 ( results [ i ] as Uint8Array ) . length !== U32 . SIZE_BYTE ||
Original file line number Diff line number Diff line change @@ -37,9 +37,9 @@ export async function getGlobalMetadata(
3737 const metadataKeyBytes = metadataKeys [ index ] . slice (
3838 GLOBAL_METADATA_TAG . length
3939 )
40- const key = String . fromCharCode ( ...new Uint8Array ( metadataKeyBytes ) ) ;
40+ const key = String . fromCharCode ( ...new Uint8Array ( metadataKeyBytes ) )
4141 if ( ! m ) {
42- throw new Error ( `Global metadata with key ${ key } has empty value` ) ;
42+ throw new Error ( `Global metadata with key ${ key } has empty value` )
4343 }
4444 const value = String . fromCharCode ( ...new Uint8Array ( m ) )
4545
Original file line number Diff line number Diff line change @@ -23,12 +23,11 @@ export async function listFiles(
2323 const fileLocations = await provider . readStorage ( scAddress , allStorageKeys )
2424
2525 return fileLocations . map ( ( location , i ) => {
26- if ( ! location ) {
27- throw new Error ( `File location not found at index ${ i } ` ) ;
28- }
29- return String . fromCharCode ( ...new Uint8Array ( location ) ) ;
26+ if ( ! location ) {
27+ throw new Error ( `File location not found at index ${ i } ` )
3028 }
31- ) ;
29+ return String . fromCharCode ( ...new Uint8Array ( location ) )
30+ } )
3231}
3332
3433/**
@@ -87,15 +86,15 @@ export async function getFileFromAddress(
8786 datastoreKeys . push ( fileChunkKey ( new Uint8Array ( filePathHash ) , i ) )
8887 }
8988
90- const rawChunks = ( await provider . readStorage ( scAddress , datastoreKeys ) )
91- . map ( // allow to return Uint8Array[] instead of (Uint8Array | null)[]
92- ( chunk , i ) => {
93- if ( ! chunk ) {
94- throw new Error ( `file ${ filePath } Chunk ${ i } not found` ) ;
95- }
96- return chunk ;
89+ const rawChunks = ( await provider . readStorage ( scAddress , datastoreKeys ) ) . map (
90+ // allow to return Uint8Array[] instead of (Uint8Array | null)[]
91+ ( chunk , i ) => {
92+ if ( ! chunk ) {
93+ throw new Error ( `file ${ filePath } Chunk ${ i } not found` )
9794 }
98- ) ;
95+ return chunk
96+ }
97+ )
9998
10099 const totalLength = rawChunks . reduce ( ( acc , chunk ) => acc + chunk . length , 0 )
101100 const concatenatedArray = new Uint8Array ( totalLength )
You can’t perform that action at this time.
0 commit comments