Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
/ nodejs-fm Public archive

Barebones file managment for file serving, supports uploads and moves.

License

Notifications You must be signed in to change notification settings

chrisvrose/nodejs-fm

Repository files navigation

nodejs-fm

Node.js CI

A simple file manager for managing files on a remote fs using Node.

Sample Image

Dependencies: express body-parser @fortawesome/fontawesome-free jquery connect-busboy,morgan Dependencies(testing): chai mocha chai-http

Why

Personal requirement. Because of this, only renaming/moving(only in same fs, due to fs.rename()) is available, and uploading/downloading. No authentication, as it is based on a small local server, and the major way of accessing it, is ssh.

TOC

Usage

Use settings.json and point it to a valid path, and select a required port. Default 8080. Refer how to use settings.json.

Travis only checks the backend, which is a separate entity.

For running it:

# Clone repo
git clone https://github.com/chrisvrose/nodejs-fm.git
# Move into repo folder
cd nodejs-fm/
# Setup the project
npm i
# Your own config, start with settings.json
#...
# Start the server
npm start

# Tests
npm test

Using settings.json

You need to have a settings.json in the project directory. A sample has been provided for usage.

Key Type Default Desc
dirname string ./sandbox Directory to serve
showHidden boolean false Show hidden files
port number 8080 Webserver listening port

Server requests

Requests:

{
    "loc": "<valid location>"
}

Responses (View directory):

{
    "loc": "<location>",
    "back": "<location>|null",
    "contents":[
        {
            "name":"<filename>",
            "path":"<location>",
            "isDir": "true|false"
        },
    ]
}

Responses(Rename/Move Success,Upload)

{
    "loc":"<new location>"
}

Credit

  • Samuel Thornton: Material Design Box Shadows
  • Chris Pratt: File Download via Ajax
  • StackOverflow: Troubleshooting errors
  • Google: All knowing

Checklist

  • Folder Traversal
  • File Downloads
  • File Moving
  • Upload

Dev Checklist

  • Folder Traversal
  • File Downloads
  • File Moving
  • Upload
  • Integration with frontend

About

Barebones file managment for file serving, supports uploads and moves.

Topics

Resources

License

Stars

Watchers

Forks