Giter Site home page Giter Site logo

jakoblorz / zipstore Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 15 KB

Create a small-scale http multipart file-server. Makes use of each cpu on the device.

License: MIT License

Shell 42.91% TypeScript 57.09%
iot azure azure-storage api filesystem file-upload s3 aws multipart http microservice microservices-architecture

zipstore's Introduction

zipstore

Create a hassle-free small-scale http multipart file-server. Makes use of each cpu on the device (cluster-mode).

Installation

Currently, only Linux Distributions are supported, which support systemd (tested in ubuntu 16.04):

  1. Clone this repository into /opt
  2. cd into the repository: cd ./zipstore
  3. Invoke the install script with sudo-privileges: sudo ./install.sh
  4. The script will have registered and built this service and will let it run using systemd with auto-restart.

Usage

This service will listen on default port 8080 (customize the zipstore.service file and see section Customization) and has 3 routes registered:

  • POST /?ref=<field> upload a file using form-data. Specify the form-key for the file you wish to upload in the url at <field>:
curl -X POST \
  'http://localhost:8000/?ref=data' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F 'data=@/path/to/file.pdf'
{
    "id": "2d7581df-7db5-4859-b494-13956280695e",
    "mime": "application/pdf",
    "extname": ".pdf"
}
  • GET /<id> download a file. Use the id from the upload-response in the url:
curl -X GET \
  http://localhost:8000/2d7581df-7db5-4859-b494-13956280695e \
  -H 'cache-control: no-cache'
  • DELETE /<id> delete a file. Use the id from the upload-response in the url:
curl -X DELETE \
  http://localhost:8000/2d7581df-7db5-4859-b494-13956280695e \
  -H 'cache-control: no-cache'

Customization

This service is sensitive to the following env-variables:

  • FILEROOT: specify the folder where files should be stored (will be created if it does not exist); os.homedir()/.zipstore-data is the default folder, /var/lib/zipstore/.data is the default service folder.
  • NODE_ENV: specify the deploy-setting (will only impact logging output look)
  • PORT: specify the port to listen for incomming requests; 8000 is the default port, 8080 is the default service port.
  • HOSTNAME: specify the interface to listen to (127.0.0.1, localhost, 0.0.0.0, host-ip); localhost is the default hostname (for the service as well: use nginx to allow external access to this service to enhance security).

Future

  • support upstream blob-providers: Microsoft Azure File Service, Amazon AWS S3 File Storage to backup / sync high-scale application files.
  • support file compression to reduce IO usage.
  • create cli-tool to get insights and configure the service.
  • create cluster-mode with multiple servers (sharding).

zipstore's People

Contributors

jakoblorz avatar

Watchers

 avatar  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.