From d0323b244519003849bb43b27073c293ccdc8e77 Mon Sep 17 00:00:00 2001 From: Igor Shadurin Date: Sat, 14 Oct 2023 13:06:28 +0300 Subject: [PATCH] docs: added example --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 1a489c79..ca075013 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,14 @@ await fdp.file.downloadData('my-new-pod', '/myfile.txt', { console.log(event) } }) + +// or you can download data block-by-block to combine it later +const blockSize = 1000000 +const fileMeta = await fdp.file.getMetadata(pod, fullPath) +const result = new Uint8Array(fileMeta.fileSize) +for (let i = 0; i < blocksCount; i++) { + result.set(await fdp.file.downloadDataBlock(fileMeta, i), i * blockSize) +} ``` Deleting a pod