Skip to content

Commit

Permalink
Release v3.0.0
Browse files Browse the repository at this point in the history
* 馃挜 Require Node.js >= 14.18
* 馃挜 Added correct http status codes for error responses
* Added option to serve a custom index html file
* Fixed false upload ok message when no file was uploaded
* Updated formidable dependency
* Refactored and optimized some code parts
* Switched to ES module style
* Added eslint checks for better code
  • Loading branch information
crycode-de committed Sep 11, 2023
1 parent 53051d1 commit 6e51b46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Changelog

## v3.0.0 (WIP)
## v3.0.0 (2023-09-11)

* 馃挜 Require Node.js >= 14.18
* Added correct http status codes for error responses
* 馃挜 Added correct http status codes for error responses
* Added option to serve a custom index html file
* Fixed false upload ok message when no file was uploaded
* Updated formidable dependency
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ By default files are uploaded to the current working directory.

Optionally a token may be used to protect against unauthorized uploads.


## Installation

Version 3 of `http-server-upload` requires Node.js 14.18 or higher.
Expand All @@ -22,7 +21,6 @@ npm install --global http-server-upload

This will install `http-server-upload` globally so that it may be run from the command line.


## Usage

```sh
Expand All @@ -40,7 +38,6 @@ until the next free port is found. This can be disabled, see below.

*Attention:* Already existing files will be overwritten on upload.


### Arguments and environment variables

The optional configuration is done by command line arguments or environment variables.
Expand All @@ -61,6 +58,7 @@ corresponding environment variable will be ignored.
| `--help`, `-h` | | Show some help text | |

Examples:

```sh
PORT=9000 UPLOAD_DIR=~/uploads/ UPLOAD_TMP_DIR=/tmp/ TOKEN=my-super-secret-token http-server-upload

Expand All @@ -69,15 +67,16 @@ http-server-upload --port=9000 --upload-dir="c:\users\peter\Path With Whitespace
PORT=9000 http-server-upload --disable-auto-port --enable-folder-creation ./
```
### Uploads from the command line
If the `http-server-upload` is running, you may also upload files from the command line using `curl`:
```sh
curl -F "uploads=@my-file.txt" http://localhost:8080/upload
```
Advanced example with multiple files, an upload path and a required token:
```sh
curl \
-F "uploads=@my-file.txt" \
Expand All @@ -88,14 +87,18 @@ curl \
```
Example for uploading content from a pipe:
```sh
cat my-file.dat | curl -F "uploads=@-;filename=my-file.dat;type=application/octet-stream" http://localhost:8080/upload
cat my-file.dat \
| curl -F "uploads=@-;filename=my-file.dat;type=application/octet-stream" \
http://localhost:8080/upload
```
Notice the required `filename` and `type` defintions for uploading piped data.
The `type` is the mime type of the data to upload.
## License
MIT license
Copyright (c) 2019-2023 Peter M眉ller <peter@crycode.de> https://crycode.de
Copyright (c) 2019-2023 Peter M眉ller <peter@crycode.de> <https://crycode.de>

0 comments on commit 6e51b46

Please sign in to comment.