Skip to content

Commit 25cd791

Browse files
committed
remove unfinished guides from list
1 parent 13b7489 commit 25cd791

File tree

2 files changed

+17
-26
lines changed

2 files changed

+17
-26
lines changed

docs/develop/access-the-swarm/introduction.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,8 @@ id: introduction
55

66
This section introduces guides for the primary use cases of building on Swarm.
77

8+
* [**Upload and Download**](/docs/develop/access-the-swarm/upload-and-download) - Learn how to upload and retrieve different types of data from Swarm, in both Node.js and browser environments.
89

9-
### [**Upload and Download**](/docs/develop/access-the-swarm/upload-and-download)
10-
Learn how to upload and retrieve different types of data from Swarm, in both Node.js and browser environments.
10+
* [**Host a Website**](/docs/develop/access-the-swarm/host-your-website) - Publish a website to Swarm, and optionally configure ENS for a human-readable domain.
1111

12-
### [**Host a Website**](/docs/develop/access-the-swarm/host-your-website)
13-
Publish a website to Swarm, and optionally configure ENS for a human-readable domain.
14-
15-
### [**Publish Updatable Content**](/docs/develop/access-the-swarm/updatable-content)
16-
Explore how to make your content evolve over time on Swarm, with serialized updates that keep a stable reference.
17-
18-
### [**Add Access Control**](/docs/develop/access-the-swarm/act)
19-
Restrict access to your Swarm content and share it only with authorized users.
20-
21-
### [**Messaging on Swarm**](/docs/develop/access-the-swarm/messaging)
22-
Integrate messaging into your dApps using Swarm — from private encrypted messages to real-time communication.
12+
* [**Add Access Control**](/docs/develop/access-the-swarm/act) - Restrict access to your Swarm content and share it only with authorized users.

docs/develop/access-the-swarm/upload-and-download.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ Some
5252
**Full example:**
5353

5454
```js
55-
// Single file upload & download (Node.js) — logs content to terminal
56-
5755
import { Bee, Size, Duration } from "@ethersphere/bee-js"
5856
import { readFile } from "node:fs/promises"
5957

@@ -63,19 +61,19 @@ const bee = new Bee("http://localhost:1633")
6361
// 2) Buy storage (postage stamp batch) for this session
6462
const batchId = await bee.buyStorage(Size.fromGigabytes(1), Duration.fromDays(1))
6563

66-
// 3) Read the file from disk as bytes
64+
// 3) Read the file from disk
6765
const data = await readFile("./hello.txt")
6866

69-
// 4) Upload the bytes with a filename and content type; capture the reference
67+
// 4) Upload with a filename and content type; capture the reference
7068
const { reference } = await bee.uploadFile(batchId, data, "hello.txt", { contentType: "text/plain" })
71-
console.log("Uploaded reference:", reference)
69+
console.log("Uploaded reference:", reference.toHex())
7270

7371
// 5) Download the file back using the reference
7472
const file = await bee.downloadFile(reference)
7573

7674
// 6) Log the file's metadata and contents to the terminal
77-
console.log(file.name) // e.g., "hello.txt"
78-
console.log(file.contentType) // e.g., "text/plain"
75+
console.log(file.name) // "hello.txt"
76+
console.log(file.contentType) // "text/plain"
7977
console.log(file.data.toUtf8()) // Prints file content
8078
```
8179

@@ -111,15 +109,18 @@ const bee = new Bee("http://localhost:1633")
111109

112110
// 1) Buy storage
113111
const batchId = await bee.buyStorage(Size.fromGigabytes(1), Duration.fromDays(1))
112+
console.log("Batch ID:", String(batchId))
114113

115-
// 2) Upload a single file from an <input type="file" id="file">
116-
const fileInput = document.querySelector("#file")!
117-
const selected = fileInput.files![0] // a File object
118-
const { reference } = await bee.uploadFile(batchId, selected)
114+
// 2) Upload a single file created in code
115+
const file = new File(["Hello Swarm!"], "hello.txt", { type: "text/plain" })
116+
const { reference } = await bee.uploadFile(batchId, file)
117+
console.log("Reference:", String(reference))
119118

120-
// 3) Download (gets name, type, and data back)
119+
// 3) Download and print name + contents
121120
const downloaded = await bee.downloadFile(reference)
122-
console.log(downloaded.name) // "your-file-name.ext"
121+
console.log(downloaded.name) // "hello.txt"
122+
console.log(file.contentType) // "text/plain"
123+
console.log(downloaded.data.toUtf8()) // prints file content
123124
```
124125

125126
### Multiple files — Browser

0 commit comments

Comments
 (0)