You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bee nodes — along with tools used for working with them like `bee-js` and `swarm-cli` — let you upload whole folders of files to Swarm.
10
+
Bee nodes — and tools like `bee-js` and `swarm-cli` — let you upload entire folders of files to Swarm.
11
11
12
-
Swarm doesn’t technically have a filesystem, but can *act like one* using **manifests**, which map readable paths (like `/images/cat.jpg`) to immutable Swarm references.
12
+
Swarm doesn’t have a traditional file system like your computer does. Instead, when uploading a collection of files, it uses something called a **manifest**, which acts like a map between relative file paths (like `/images/cat.jpg`) and the actual content stored on Swarm.
13
13
14
-
:::info
15
-
The `bee-js`[`MantarayNode` class](https://github.com/ethersphere/bee-js?tab=readme-ov-file#swarm-primitives) is the main way to work with manifests in NodeJS.
14
+
A manifest is stored in a compact binary [encoded **prefix trie**](https://en.wikipedia.org/wiki/Trie).
16
15
17
-
The name comes from an older (now deprecated) library, so you may still see manifests referred to as **“Mantaray manifests.”**
18
-
:::
16
+
A prefix trie is like a tree that stores file paths by breaking them into shared chunks. For example, `images/cat.jpg` and `images/dog.jpg` both start with `images/`, so they share a common branch.
19
17
20
-
A manifest is stored as a compact, binary-encoded **prefix trie**. Each node in the trie represents part of a file path and may contain:
18
+
This *saves space*and *makes lookups fast*.
21
19
22
-
- a path segment
23
-
- a trie fork
24
-
- a reference to the root chunk of the file’s Swarm hash
25
-
- file metadata (content type, filename, etc.)
20
+
Each entry in the manifest includes:
26
21
27
-
:::info
28
-
A **trie** is a special type of tree that stores data based on **shared prefixes**.
29
-
This makes lookups fast and avoids repeating long path segments.
30
-
:::
22
+
* a part of the file path (like `images/`)
23
+
* a reference to the file's data (its Swarm hash)
24
+
* optional metadata (such as file name or content type)
25
+
26
+
With manifests, Swarm can serve your content at readable URLs while still storing it securely and immutably.
31
27
32
28
Manifests give Swarm two powerful features:
33
29
@@ -36,11 +32,11 @@ Manifests give Swarm two powerful features:
36
32
37
33
:::info
38
34
Manifests are stored on Swarm as raw binary data.
39
-
To work with them, these bytes must be **unmarshalled** (decoded) into a structured form.
35
+
To work with them, these bytes must be [**unmarshalled** (decoded)](https://en.wikipedia.org/wiki/Marshalling_(computer_science)) into a structured form.
40
36
41
-
Although `bee-js` provides this functionality through the `MantarayNode` class, although in theory could be done with any language as long as it preserves the trie data.
37
+
`bee-js` provides this functionality through the `MantarayNode.umarshal` method.
42
38
43
-
After unmarshalling, the data is still quite low-level (for example, many fields are `Uint8Array` values) and usually needs additional processing to make it human-readable. You can find a [script for this in the `ethersphere/examples` repo](https://github.com/ethersphere/examples/blob/main/manifests/printManifestJson.js).
39
+
After unmarshalling, the data is still quite low-level (for example, many fields are `Uint8Array` values) and usually needs additional processing to make it human-readable. You can find a [script for this in the `ethersphere/examples` repo](https://github.com/ethersphere/examples/blob/main/manifests/manifestToJson.js).
0 commit comments