Giter Site home page Giter Site logo

purusha / restfs Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 1.16 MB

Restfs exposes your file system as a rest api. Is not a static file server, but instead lets you browse stats, and manipulate files through arbitrary paths.

Java 45.84% Shell 0.33% HTML 11.04% CSS 38.91% JavaScript 3.13% Dockerfile 0.74%

restfs's Introduction

restfs

Restfs exposes your file system as a rest api. Is not a static file server, but instead lets you browse stats, and manipulate files through arbitrary paths.

It is possible to manage multiple containers (multi tenant), each with its own "virtual" file system.
For this reason the X-Container header is mandatory in every single request.
Each container has its own method for authenticating requests; the available methods are:

  1. oAuth
  2. basic authentication
  3. generate token from master password
  4. no auth

Available operation on container:

  • create folder (any path)

    Request:
    POST /dir/dir1/dir2?op=MKDIRS
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
        "children":[
        ],
        "created":"2019-01-29@17:05:54",
        "lastAccess":"2019-01-29@17:05:54",
        "length":0,
        "modified":"2019-01-29@17:05:54",
        "name":"dir2",
        "type":"FOLDER"
    }
  • create file (folder must exist)

    Request:
    POST /dir/user42?op=CREATE
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
        "created":"2019-01-29@17:05:54",
        "lastAccess":"2019-01-29@17:05:54",
        "length":0,
        "modified":"2019-01-29@17:05:54",
        "name":"user42",
        "type":"FILE"
    }
  • get file attributes

    Request:
    GET /dir/user42?op=GETSTATUS
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
        "created":"2019-01-29@17:05:54",
        "lastAccess":"2019-01-29@17:05:54",
        "length":0,
        "modified":"2019-01-29@17:05:54",
        "name":"user42",
        "type":"FILE"
    }
  • get folder attributes

    Request:
    GET /dir/dir1?op=LISTSTATUS
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
        "children":[
        ],
        "created":"2019-01-29@17:05:54",
        "lastAccess":"2019-01-29@17:05:54",
        "length":0,
        "modified":"2019-01-29@17:05:54",
        "name":"dir1",
        "type":"FOLDER"
    }
  • rename file

    Request:
    PUT /dir/dir2/user42?op=RENAME&target=user42
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
    }
  • rename folder

    Request:
    PUT /dir/dir1?op=RENAME&target=dir2
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
    }
  • delete file

    Request:
    DELETE /dir/email-reset42?op=DELETE
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
    }
  • delete folder

    Request:
    DELETE /dir/to-be-deleted?op=DELETE
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
    }
  • move file in any existing path

    Request:
    PUT /dir/dir2/user42?op=MOVE&target=dir/dir2
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
    }
  • move folderX in any existing folder

    Request:
    PUT /dir/dir2/dir3/dir4?op=MOVE&target=dir/dir2
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
    }
  • append text on existing file (text or gzip)

    Request:
    POST /dir/user42?op=APPEND
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF
    Content-Encoding: gzip OR identity (based on what add into the body)
    BODY content is what will be saved into the file

    Response:

    {
        "created":"2019-01-29@17:05:54",
        "lastAccess":"2019-01-29@17:05:54",
        "length":108,
        "modified":"2019-01-29@17:05:54",
        "name":"user42",
        "type":"FILE"
    }
  • retrieve file

    Request:
    GET /dir/user42?op=OPEN
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
        "content":[
            "first line",
            "second line",
            "afsidbfasbdflasbdfljasdf asdfuasd fuas ydfasd fasudfyvasdf",
            "last line"
        ],
        "path":"/dir/file5"
    }

Management operation on container:

  • stats

    Request:
    GET /stats
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
    }
  • last N call (N configurable)

    Request:
    GET /latest
    Authorization: XXX-YYY-ZZZ
    Accept: application/json
    X-Container: UUU-OOO-PPP-KKK-LLL-HGF

    Response:

    {
    }
  • webhook (configurable for flush data on expired time or number of events)

This is project is under develop ... see todo file to discover new functionality todo file

It is possible to build the project independently and run it on any machine;
steps are:

  1. git clone https://github.com/purusha/restfs.git
  2. cd restfs/backend
  3. mvn install
  4. java -jar target/restfs-[VERSION].jar

Restfs expose two ports: the first public http://localhost:8081 (to be used with an HTTP client); the second for administration purpose http://localhost:8086/containers (to be used with a browser)

restfs's People

Contributors

purusha avatar

Stargazers

Leonard Bogdonoff avatar  Antonio Luca avatar

Watchers

 avatar

Forkers

rememberlenny

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.