Coder Social home page Coder Social logo

shangzongyu / sgfs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linkinstars/sgfs

0.0 0.0 0.0 339 KB

🚀Simple http file server. A open source file server, implement by golang that can be used to upload and download files. Simple to deploy, simple to use. 中文介绍:

Home Page: https://www.cnblogs.com/linkstar/p/10429984.html

Shell 15.27% Go 84.73%

sgfs's Introduction

SGFS

Simple Golang File Server

SGFS, a open source file server, implement by golang that can be used to upload and download files. Simple to deploy, simple to use.

Advantage

  • SGFS is easy to configure and deploy. (use yaml config and have no runtime dependencies)

  • SGFS is easy to start and stop. (use ./startup.sh to start and use ./shutdown.sh to stop)

  • SGFS is easy to use. (use HTTP to upload and delete file)

  • SGFS use fasthttp to implement. (strong ability to deal with concurrent problems and fast speed. [https://github.com/valyala/fasthttp])

Quick Start

PS: Note that the default file operation port is 9001, and the default file access port is 9002, which is different.

HTTP

Upload file

Url : "http://127.0.0.1:9001/upload-file"
Method : "http + post + multipart/form-data"

Request

key value
file upload file
uploadSubPath file save path,like “pic”
token operation_token,like “654321”

Response

{
    "code": 1,
    "message": "Save file success.",
    "data": "/pic/2019-02-22/20190222151902_7848902316.jpg"
}

code = 1 means success
code != 1 means fail


Delete file

Url : "http://127.0.0.1:9001/delete-file"
Method : "http + post + multipart/form-data"

Request

key value
fileUrl like "/pic/2019-02-22/20190222151902_7848902316.jpg"
token operation_token,like "654321"

Response

{
    "code": 1,
    "message": "Delete file success.",
    "data": null
}

code = 1 means success
code != 1 means fail

About Update

When you want to update the sgfs, please note the following points.

  1. Do not delete upload folder because it saved files.
  2. If you modify the conf.yml about old version please backup it before update.
  3. Download release version and decompression to update. Easy.

TODO

  • remove startup and shutdown scripts
  • add cli commands to start server and shutdown
  • code cleanup
  • add unit tests

sgfs's People

Contributors

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