{"id":21101152,"url":"https://github.com/crycode-de/http-server-upload","last_synced_at":"2025-05-16T18:34:22.035Z","repository":{"id":41052146,"uuid":"406427466","full_name":"crycode-de/http-server-upload","owner":"crycode-de","description":"A simple zero-configuration command-line http server for uploading files.","archived":false,"fork":false,"pushed_at":"2024-03-14T19:06:44.000Z","size":173,"stargazers_count":37,"open_issues_count":0,"forks_count":11,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-01T12:17:10.935Z","etag":null,"topics":["file-upload","http-server","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crycode-de.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["crycode-de"],"custom":["https://www.paypal.me/petercrycode"]}},"created_at":"2021-09-14T15:40:39.000Z","updated_at":"2024-04-26T04:34:48.000Z","dependencies_parsed_at":"2024-03-14T19:41:54.910Z","dependency_job_id":"770fc61f-cb52-463b-b8b3-a7348c68da27","html_url":"https://github.com/crycode-de/http-server-upload","commit_stats":{"total_commits":24,"total_committers":4,"mean_commits":6.0,"dds":"0.16666666666666663","last_synced_commit":"8af34cc1176c21cd7431b0ffa8ae103452d6e1ff"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crycode-de%2Fhttp-server-upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crycode-de%2Fhttp-server-upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crycode-de%2Fhttp-server-upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crycode-de%2Fhttp-server-upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crycode-de","download_url":"https://codeload.github.com/crycode-de/http-server-upload/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225444760,"owners_count":17475353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-upload","http-server","nodejs"],"created_at":"2024-11-19T23:40:21.552Z","updated_at":"2024-11-19T23:40:22.091Z","avatar_url":"https://github.com/crycode-de.png","language":"JavaScript","funding_links":["https://github.com/sponsors/crycode-de","https://www.paypal.me/petercrycode"],"categories":[],"sub_categories":[],"readme":"# http-server-upload\n\n[![NPM version](https://img.shields.io/npm/v/http-server-upload.svg)](https://www.npmjs.com/package/http-server-upload)\n[![Downloads](https://img.shields.io/npm/dm/http-server-upload.svg)](https://www.npmjs.com/package/http-server-upload)\n\n[![NPM](https://nodei.co/npm/http-server-upload.png?downloads=true)](https://nodei.co/npm/http-server-upload/)\n\nThis is a simple zero-configuration command-line http server which provides a lightweight interface to upload files.\n\nBy default files are uploaded to the current working directory.\n\nOptionally a token may be used to protect against unauthorized uploads.\n\n## Installation\n\nVersion 3 of `http-server-upload` requires Node.js 14.18 or higher.\n\n```sh\nnpm install --global http-server-upload\n```\n\nThis will install `http-server-upload` globally so that it may be run from the command line.\n\n## Usage\n\n```sh\nhttp-server-upload [arguments] [uploadRootPath]\n```\n\n`[uploadRootPath]` defaults to the current working directory (`./`).\n\nOther options can be set using environment variables.\n\nWhen the server is running you can visit http://localhost:8080/ to get the upload form.\n\nIf the desired port is already in use, the port will be increased automatically\nuntil the next free port is found. This can be disabled, see below.\n\n*Attention:* Already existing files will be overwritten on upload.\n\n### Docker\n\nYou can use the docker image [crycode/http-server-upload](https://hub.docker.com/r/crycode/http-server-upload) from the Docker Hub.\n\nSimple usage example:\n\n```sh\ndocker run --rm -it -p 8080:8080 crycode/http-server-upload\n```\n\nYou may also overwrite default options using environment variables  (see below for available variables) and use volumes or bind mounts for upload storage:\n\n```sh\ndocker run --rm -it -p 8080:8080 -e TOKEN=foo -e ENABLE_FOLDER_CREATION=1 -v $(pwd):/upload crycode/http-server-upload\n```\n\nOr you build a container image youself from this repository:\n\n```sh\ndocker build -t http-server-upload .\n```\n\n### Arguments and environment variables\n\nThe optional configuration is done by command line arguments or environment variables.  \nIf both are used, the arguments have higher priority and the value from the\ncorresponding environment variable will be ignored.\n\n| Argument | Variable | Description | Default |\n|---|---|---|---|\n| `--port` | `PORT` | The port to use. | `8080` |\n| `--upload-dir` | `UPLOAD_DIR` | The directory where the files should be uploaded to. This overrides the `uploadRootPath` argument. | `uploadRootPath` argument or the current working directory |\n| `--upload-tmp-dir` | `UPLOAD_TMP_DIR` | Temp directory for the file upload. | The upload directory. |\n| `--max-file-size` | `MAX_FILE_SIZE` | The maximum allowed file size for uploads in Megabyte. | `200` |\n| `--token` | `TOKEN` | An optional token which must be provided on upload. | Nothing |\n| `--path-regexp` | `PATH_REGEXP` | A regular expression to verify a given upload path. This should be set with care, because it may allow write access to outside the upload directory. | `/^[a-zA-Z0-9-_/]*$/` |\n| `--disable-auto-port` | `DISABLE_AUTO_PORT` | Disable automatic port increase if the port is nor available. | Not set. |\n| `--enable-folder-creation` | `ENABLE_FOLDER_CREATION` | Enable automatic folder creation when uploading file to non-existent folder. | Not set. |\n| `--index-file` | `INDEX_FILE` | Use a custom html file as index instead of the default internal index. If used, the form fields need to have the same names as in the original index. | Not set. |\n| `--help`, `-h` | | Show some help text | |\n\nExamples:\n\n```sh\nPORT=9000 UPLOAD_DIR=~/uploads/ UPLOAD_TMP_DIR=/tmp/ TOKEN=my-super-secret-token http-server-upload\n\nhttp-server-upload --port=9000 --upload-dir=\"c:\\users\\peter\\Path With Whitespaces\\\"\n\nPORT=9000 http-server-upload --disable-auto-port --enable-folder-creation ./\n```\n\n### Uploads from the command line\n\nIf the `http-server-upload` is running, you may also upload files from the command line using `curl`:\n\n```sh\ncurl -F \"uploads=@my-file.txt\" http://localhost:8080/upload\n```\n\nAdvanced example with multiple files, an upload path and a required token:\n\n```sh\ncurl \\\n  -F \"uploads=@my-file.txt\" \\\n  -F \"uploads=@my-other-file.txt\" \\\n  -F \"path=my/dir\" \\\n  -F \"token=my-super-secret-token\" \\\n  http://localhost:8080/upload\n```\n\nExample for uploading content from a pipe:\n\n```sh\ncat my-file.dat \\\n  | curl -F \"uploads=@-;filename=my-file.dat;type=application/octet-stream\" \\\n  http://localhost:8080/upload\n```\n\nNotice the required `filename` and `type` defintions for uploading piped data.  \nThe `type` is the mime type of the data to upload.\n\n## License\n\nMIT license\n\nCopyright (c) 2019-2024 Peter Müller \u003cpeter@crycode.de\u003e \u003chttps://crycode.de\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrycode-de%2Fhttp-server-upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrycode-de%2Fhttp-server-upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrycode-de%2Fhttp-server-upload/lists"}