rstr

A simple content-addressable blob-store written in rust.

After uploading a file to the blob store you will receive a unique reference to it (its sha256 hash) which can be used to retrieve/delete it.

Features

Installation

In order to use rstr you will need to have the mime database installed in one of these paths (see tree_magic_mini documentation for more details):

"/usr/share/mime/magic",
"/usr/local/share/mime/magic",
"$HOME/.local/share/mime/magic",

MacOS

On MacOS, you can install rstr using homebrew

brew tap giuppep/tap && brew install rstr

Debian based Linux distribution (e.g. Ubuntu)

A .deb package is provided in each release:

version=0.1.0
curl -LO https://github.com/giuppep/rstr/releases/download/$version/rstr_${version}_amd64.deb
sudo dpkg -i rstr_${version}_amd64.deb

Usage

rstr provides both a CLI and a web server with a REST API to upload/get/delete blobs.

See the complete documentation and the API Documentation for more details.

A complete Python API client is available here.

Example

First of all, generate an api token and start the server

TOKEN=$(rstr server generate-token)
rstr server start

To add a file, simply send a POST request to the /blobs endpoint:

curl -i -X POST https://my-rstr-url.rs/blobs \
-H "X-Auth-Token: $TOKEN" \
-F file=@path/to/a/file.pdf

If the upload is successful, you will receive the hash of the file in the response:

HTTP/1.1 200 OK
content-length: 68
content-type: application/json
date: Sat, 19 Jun 2021 22:43:01 GMT

["c1d18efa9781db45217d594b75e31801318fd1834358c081487fb716ac8139ef"]%

The hash can then be used to retrieve the file

curl -O https://my-rstr-url.rs/blobs/c1d18efa9781db45217d594b75e31801318fd1834358c081487fb716ac8139ef \
-H "X-Auth-Token: $TOKEN"

License

Copyright (c) 2021 giuppep

rstr is made available under the MIT License