Skip to main content
added 222 characters in body
Source Link
lash
  • 685
  • 5
  • 15

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
f3f1f9d14ac8413d928744cad75e5620661446dcfe7108cb269305af41b164c2
$ 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/
foo

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 
211a9fade237e05307c86135af61d3d09f82324117bcac41d7dc91da53901018
$ curl -X GET http://localhost:8500/bzz-raw:/211a9fade237e05307c86135af61d3d09f82324117bcac41d7dc91da53901018/
bar

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

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
f3f1f9d14ac8413d928744cad75e5620661446dcfe7108cb269305af41b164c2
$ 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/
foo

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 
211a9fade237e05307c86135af61d3d09f82324117bcac41d7dc91da53901018
$ curl -X GET http://localhost:8500/bzz-raw:/211a9fade237e05307c86135af61d3d09f82324117bcac41d7dc91da53901018/
bar

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
f3f1f9d14ac8413d928744cad75e5620661446dcfe7108cb269305af41b164c2
$ 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/
foo

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 
211a9fade237e05307c86135af61d3d09f82324117bcac41d7dc91da53901018
$ curl -X GET http://localhost:8500/bzz-raw:/211a9fade237e05307c86135af61d3d09f82324117bcac41d7dc91da53901018/
bar

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
Source Link
lash
  • 685
  • 5
  • 15

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
f3f1f9d14ac8413d928744cad75e5620661446dcfe7108cb269305af41b164c2
$ 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/
foo

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 
211a9fade237e05307c86135af61d3d09f82324117bcac41d7dc91da53901018
$ curl -X GET http://localhost:8500/bzz-raw:/211a9fade237e05307c86135af61d3d09f82324117bcac41d7dc91da53901018/
bar