Giter Site home page Giter Site logo

kcoms555 / tinystorage Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 20 KB

It serves a tiny storage and can be used as a short-term tiny data transfer service and etc.

License: MIT License

JavaScript 100.00%
short-term-data-transfer cloud-storage-service

tinystorage's Introduction

tinystorage

Tiny Cloud Storage Server
It serves a tiny storage and can be used as a short-term tiny data transfer service and etc.

Example

Sender

curl http://jeto.ga/api/tinystorage/guest/source_code.c --data-binary @source_code.c
Upload a file to the server.

Receiver

wget http://jeto.ga/api/tinystorage/guest/source_code.c
Download it from the server.

Test Server

http://jeto.ga/api/tinystorage
If it is not available, then send me a mail.
Any auth_key is acceptable.

Installation

1. Download or clone it

git clone https://github.com/kcoms555/tinystorage

2. Go to the tinystorage directory

cd tinystorage

3. Install dependencies

npm install

or

npm install body-parser express read-config async

4. Run Server

node tinystorage.js

API

Upload data

Request

POST /{auth_key}/{dict_key}

curl http://jeto.ga/api/tinystorage/guest/mymessage -d "I am tinystorage !"  

auth_key is a key registered to the server. If use_public option is true, then any value for auth_key is acceptable. dict_key is a dictionary key. Any value for dict_key is acceptable.

It will upload a message "I am tinystorage !" to the server on '/guest/mymessage'.
Anyone having valid auth_key can upload anything he wants.

Response

HTTP/1.1 200 OK
Date: Sat, 26 Sep 2020 17:39:05 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: Express

Download data

Request

GET /{auth_key}/{dict_key}

curl http://jeto.ga/api/tinystorage/guest/mymessage

It will download a message "I am tinystorage !" from the on '/guest/mymessage'.
Anyone having valid auth_key can download anything he needs.
Once data is read, then it will be deleted.

Response

HTTP/1.1 200 OK
Date: Sat, 26 Sep 2020 17:42:16 GMT
Content-Type: application/json
Content-Length: 18
Connection: keep-alive
X-Powered-By: Express
ETag: W/"12-Y5fDOSAhmtW9uFIFMK1cfvw+/Vo"

I am tinystorage !

HTTP Status Code

HTTP 200 : Successfully uploaded or downloaded.
HTTP 201 : Successfully overwritten.
HTTP 400 : auth_key or dict_key or data is not available.
HTTP 500 : Server Internal Error.

Configuration

Open config.json and write it as you need.

  • auth_keys : A list for auth_keys. A auth_key in auth_keys is valid when use_public is false.
  • use_public : if true, any auth_key is accepable.
  • port : A server port.
  • limit : Limit of data size to upload.

Known Problems (will be fixed)

  • There is no limit to upload.
  • Data that is not read is on the memory as long as the server is alive.
  • If the server is closed, there is no way to restore data not read.

tinystorage's People

Contributors

kcoms555 avatar

Watchers

 avatar

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.