From 8f4e618366f4ddf8aaa98373b82b4d32c31d4327 Mon Sep 17 00:00:00 2001 From: NoahMaizels Date: Tue, 31 Mar 2026 15:18:17 +0700 Subject: [PATCH] fix: correct read.js API calls in multi-author-blog guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs in the read.js code block: 1. reader.download() returns { payload, feedIndex } with no reference property — replace with reader.downloadReference() which returns { reference, feedIndex } as needed by bee.downloadFile(). 2. bee.downloadFile() returns data as a bee-js Bytes object, not an ArrayBuffer — new TextDecoder().decode(authorsData.data) throws; use authorsData.data.bytes to get the underlying Buffer. Co-Authored-By: Claude Sonnet 4.6 --- docs/develop/multi-author-blog.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/develop/multi-author-blog.md b/docs/develop/multi-author-blog.md index 8709ddd4..493a15fd 100644 --- a/docs/develop/multi-author-blog.md +++ b/docs/develop/multi-author-blog.md @@ -786,12 +786,12 @@ const cfg = JSON.parse(readFileSync("config.json", "utf-8")); const indexTopic = Topic.fromString(cfg.topics.index); const indexOwner = new EthAddress(cfg.admin.owner); const indexReader = bee.makeFeedReader(indexTopic, indexOwner); -const indexResult = await indexReader.download(); +const indexResult = await indexReader.downloadReference(); console.log("Index feed at index:", indexResult.feedIndex.toBigInt()); // Download the authors.json manifest const authorsData = await bee.downloadFile(indexResult.reference); -const authors = JSON.parse(new TextDecoder().decode(authorsData.data)); +const authors = JSON.parse(new TextDecoder().decode(authorsData.data.bytes)); console.log(`\n${authors.length} authors in blog:\n`); @@ -801,7 +801,7 @@ for (const author of authors) { const owner = new EthAddress(author.owner); const reader = bee.makeFeedReader(topic, owner); try { - const result = await reader.download(); + const result = await reader.downloadReference(); console.log(`${author.name}`); console.log(` Feed index: ${result.feedIndex.toBigInt()}`); console.log(` URL: ${process.env.BEE_URL}/bzz/${author.feedManifest}/`); @@ -814,7 +814,7 @@ for (const author of authors) { const homeTopic = Topic.fromString(cfg.topics.home); const homeOwner = new EthAddress(cfg.admin.owner); const homeReader = bee.makeFeedReader(homeTopic, homeOwner); -const homeResult = await homeReader.download(); +const homeResult = await homeReader.downloadReference(); console.log(`\nHomepage feed at index: ${homeResult.feedIndex.toBigInt()}`); console.log(`Homepage URL: ${process.env.BEE_URL}/bzz/${cfg.manifests.home}/`); ```