GithubHelp home page GithubHelp logo

rochacon / s3stub Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 216 KB

Simple and unsafe blob storage API

Home Page: https://index.docker.io/u/rochacon/s3stub/

License: MIT License

Shell 5.60% Go 94.40%

s3stub's Introduction

s3stub

s3stub is a simple (and unsafe) blob storage API.

You can use it as an AWS S3 test server if you only use simple operations such as read, write or delete blobs.

Install

go get github.com/rochacon/s3stub

Run

% s3stub -h
Usage of s3stub:
  -b="127.0.0.1:8000": The address to bind to
  -r="": The root path of the server

If you have Docker installed:

% docker pull rochacon/s3stub
% docker run -d -p 8000:80 rochacon/s3stub

Usage

Listing keys

To list available keys, make a GET request:

% curl 127.0.0.1:8000/

/a-blob
/another-blob

Writing blobs

To write/update a blob, make a PUT request:

% curl -X PUT -d "new file content" 127.0.0.1:8000/filename
0eb88758c79815e61f7c3304ea43340e34773afb8b8edf561a26a40dc36fec2c

The SHA-256 hash of the file is returned for integrity check.

Reading blobs

To retrieve a blob, make a GET request:

% curl 127.0.0.1:8000/filename
new file content

Checking for blobs existence

To check for a blob existence, make a HEAD request:

% curl -i -X HEAD 127.0.0.1:8000/filename
HTTP/1.1 204 No Content
Date: Fri, 16 May 2014 04:04:00 GMT
Content-Length: 0
Content-Type: text/plain; charset=utf-8

Deleting blobs

To delete a file, make a DELETE request:

% curl -i -X DELETE 127.0.0.1:8000/filename
HTTP/1.1 204 No Content
Date: Wed, 19 Mar 2014 06:11:40 GMT
Content-Length: 0
Content-Type: text/plain; charset=utf-8

Common errors

For GET, HEAD and DELETE, if a file is not found an HTTP 404 Not Found response is returned:

% curl -i 127.0.0.1:8000/nooo
HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=utf-8
Date: Wed, 19 Mar 2014 06:00:03 GMT
Content-Length: 49

open /tmp/s3stub/nooo: no such file or directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.