As far I know, whenever we upload a file or a directory using:

swarm up File

we get back a hash that is the manifest containing the uploaded file. However, I am not sure I do understand how to extract the content of this manifest file after using the download command like following:

swarm down bzz:/given_hash

My goal is to get the original file that was uploaded. Any idea or command that can do the work?

1 Answer 1


If you take a look at the manifest itself, the hash(es) of its contents are listed as entries in the data structure. You can retrieve the verbatim data of a hash by using the bzz-raw scheme, for example:

$ echo foo > foo.txt
$ swarm up foo.txt
$ curl -X GET http://localhost:8500/bzz-raw:/f3f1f9d14ac8413d928744cad75e5620661446dcfe7108cb269305af41b164c2/
  "entries": [
      "hash": "01c9bc7199ce023fea5c28e07a81c2d61ba4a8f9bbed68a6eafab8ec8bbbfe0a",
      "contentType": "text/plain; charset=utf-8",
      "mode": 420,
      "size": 4,
      "mod_time": "2019-01-19T14:43:21-05:00"
$ curl -X GET http://localhost:8500/bzz-raw:/01c9bc7199ce023fea5c28e07a81c2d61ba4a8f9bbed68a6eafab8ec8bbbfe0a/

You can also upload without creating a manifest. In that case the returned hash is a reference to the data itself:

$ echo bar > bar.txt
$ swarm --manifest=false up  bar.txt 
$ curl -X GET http://localhost:8500/bzz-raw:/211a9fade237e05307c86135af61d3d09f82324117bcac41d7dc91da53901018/

Note that the upload actions in these two cases are actually equivalent to:

$ curl -X POST http://localhost:8500/bzz:/ --data @foo.txt
$ curl -X POST http://localhost:8500/bzz-raw:/ --data-binary @bar.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.