Files
nodejs-fm/README.md

84 lines
1.7 KiB
Markdown
Raw Normal View History

2019-05-19 10:47:08 +05:30
# nodejs-fm
2019-05-24 11:04:51 +05:30
[![Build Status](https://travis-ci.org/chrisvrose/nodejs-fm.svg?branch=master)](https://travis-ci.org/chrisvrose/nodejs-fm)
2019-05-24 12:04:21 +05:30
A simple file manager for managing files on a remote fs using Node.
2019-05-19 10:47:08 +05:30
2019-05-27 10:58:04 +05:30
Dependencies: `express` `body-parser` `@fortawesome/fontawesome-free` `jquery` `connect-busboy`
Dependencies(testing): `chai` `mocha` `chai-http`
2019-05-19 10:47:08 +05:30
2019-05-24 12:04:21 +05:30
## Checklist
2019-05-24 11:35:33 +05:30
2019-05-24 11:14:19 +05:30
- [x] Folder Traversal
2019-05-24 14:46:30 +05:30
- [X] File Downloads
2019-05-27 10:58:04 +05:30
- [X] File Moving
2019-05-27 15:07:36 +05:30
- [X] Upload
### Why
Personal requirement.
2019-05-27 14:21:36 +05:30
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.
2019-05-19 10:47:08 +05:30
2019-05-24 12:04:21 +05:30
## Usage
Use `settings.json` and point it to a valid address, and select a required port. Default `8080`
For the backend, the jsons have this form.
2019-05-24 12:04:21 +05:30
2019-05-27 14:21:36 +05:30
For running it:
```shell
# 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
```
### Server requests
2019-05-24 12:04:21 +05:30
Requests:
```javascript
2019-05-24 12:04:21 +05:30
{
2019-05-24 14:46:30 +05:30
'loc': "<valid location>"
2019-05-24 12:04:21 +05:30
}
```
2019-05-24 14:46:30 +05:30
2019-05-27 15:46:27 +05:30
Responses (View directory):
2019-05-24 12:04:21 +05:30
2019-05-24 17:55:13 +05:30
```javascript
2019-05-24 12:04:21 +05:30
{
2019-05-24 14:46:30 +05:30
'loc': "<location>",
'back': "<location|null>",
'contents':[
2019-05-24 12:04:21 +05:30
{
2019-05-24 14:46:30 +05:30
'name':"<filename>",
'path':"<location>",
'isDir': "<true|false>"
2019-05-24 12:04:21 +05:30
},
...
]
}
```
2019-05-27 15:46:27 +05:30
Responses(Rename/Move Success,Upload)
```javascript
{
'loc':"<new location>"
}
```
2019-05-24 12:04:21 +05:30
## Credit
2019-05-24 11:35:33 +05:30
2019-05-19 18:48:50 +05:30
- Samuel Thornton: [Material Design Box Shadows]("https://codepen.io/sdthornton/pen/wBZdXq")
2019-05-24 14:41:30 +05:30
- Chris Pratt: [File Download via Ajax]('https://codepen.io/chrisdpratt/pen/RKxJNo')
2019-05-24 11:27:55 +05:30
- StackOverflow: Troubleshooting errors
- Google: All knowing