From d54d00637b1b04eddf932aa6b1aec1bc289f88a1 Mon Sep 17 00:00:00 2001 From: kralverde <2b2tminecrafter2@gmail.com> Date: Thu, 19 Oct 2023 16:39:25 -0400 Subject: [PATCH] update readme --- README.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.rst b/README.rst index dc75dfa..339b9fa 100644 --- a/README.rst +++ b/README.rst @@ -34,3 +34,15 @@ Given a block store and a root cid, decode the underlying data. ... >>> asyncio.run(test()) b'some data' + +Recursively iterate through a directory. + +>>> from unix_fs_exporter import recursive_export, UnixFSFile +>>> # Creation of the blockstore is an exercise left to the reader +>>> async def test(): +... entries = recursive_export('bafybeifpaez32hlrz5tmr7scndxtjgw3auuloyuyxblynqmjw5saapewmu', block_store) +... async for entry in entries: +... assert isinstance(entry, UnixFSFile) +... async for chunk in entry.content: +... assert isinstance(chunk, bytes) +>>> asyncio.run(test())