2019-05-19 10:47:08 +05:30
|
|
|
# nodejs-fm
|
2019-05-24 11:04:51 +05:30
|
|
|
|
|
|
|
[](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
|
|
|
|
2020-09-25 10:16:54 +05:30
|
|
|

|
2019-09-14 19:51:49 +05:30
|
|
|
|
2019-05-27 10:58:04 +05:30
|
|
|
Dependencies: `express` `body-parser` `@fortawesome/fontawesome-free` `jquery` `connect-busboy`
|
2019-05-24 21:38:05 +05:30
|
|
|
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
|
2019-05-24 21:38:05 +05:30
|
|
|
|
|
|
|
### 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.
|
2019-05-24 21:38:05 +05:30
|
|
|
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
|
|
|
|
|
2019-09-15 13:23:23 +05:30
|
|
|
Use `settings.json` and point it to a valid path, and select a required port. Default `8080`.
|
2019-05-24 12:04:21 +05:30
|
|
|
|
2019-09-15 13:23:23 +05:30
|
|
|
*_Travis only checks the backend, which is a separate entity._*
|
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:
|
|
|
|
|
2019-05-24 21:38:05 +05:30
|
|
|
```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
|
2019-09-14 19:53:32 +05:30
|
|
|
- Google: All knowing
|