The storage is designed to put files in volumes much in the way Facebook's Haystack 1 works; once there a file enters the storage it can't really get deleted/modified from the volume, but instead, if a change is needed, a new file blob will be written to the volume. Storage is envisioned to be used when there are files you need to store which you know won't be changing often.

Lets add something to the storage using STORE:

{% capture req %}

STORE /twitter/images/Kronuz
Content-Type: image/png

@Kronuz.png

{% endcapture %} {% include curl.html req=req %}

And getting it is just a matter of retreiving it using GET:

{% capture req %}

GET /twitter/images/Kronuz
Accept: image/png

{% endcapture %} {% include curl.html req=req %}

{: .note} Toggle console previews
You can enable previews for images in the terminal using the very-very-very-very verbose command line option (-vvvvv). Note you a compatible terminal for this feature to work (iTerm2{:target="_blank"}, for example).

Multi-Content Documents

Use STORE with a different Content-Type to add new content to the same document:

{% capture req %}

STORE /twitter/images/Kronuz
Content-Type: application/pdf

@Kronuz.pdf

{% endcapture %} {% include curl.html req=req %}

{% capture req %}

STORE /twitter/images/Kronuz
Content-Type: image/jpeg

@Kronuz.jpg

{% endcapture %} {% include curl.html req=req %}

Then you can get either of them requesting the appropriate Content-Type:

{% capture req %}

GET /twitter/images/Kronuz
Accept: image/jpeg

{% endcapture %} {% include curl.html req=req %}

Retrieving Information

You can get the information about the document as usual:

{% capture req %}

GET /twitter/images/:info/Kronuz?pretty

{% endcapture %} {% include curl.html req=req %}

The result (partially shown) has the available content types listed inside #document_info ➛ #blobs

{
  "#document_info": {
    "#blobs": {
      "image/png": {
        "#type": "stored",
        "#volume": 0,
        "#offset": 512,
        "#size": 572272
      },
      "image/jpeg": {
        "#type": "stored",
        "#volume": 0,
        "#offset": 72411,
        "#size": 484591
      }
    }, ...
  }
}

Removing Content

To remove stored content by storing an empty object:

{% capture req %}

STORE /twitter/images/Kronuz
Content-Type: image/jpeg
Content-Length: 0

{% endcapture %} {% include curl.html req=req %}


1 Finding a needle in Haystack: Facebook's photo storage.{:target="_blank"}