Skip to content

Commit d8dfc29

Browse files
committed
fix cli prettier
1 parent 0617d3c commit d8dfc29

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

cli/src/lib/website/filesInit.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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 ||

cli/src/lib/website/metadata.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

cli/src/lib/website/read.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)