| .github/workflows | ||
| src | ||
| .gitignore | ||
| dockerfile | ||
| index.js | ||
| package-lock.json | ||
| package.json | ||
| readme.md | ||
temp-file-sharing
A simple Node.js-based temporary file sharing service, similar to dropmefiles. Users can upload files via drag & drop, file selection, or clipboard paste. A unique download link is generated for each file, which is available for a configurable retention period before the file is automatically deleted. An anti-spam mechanism limits the number of uploads per IP, and once a file is uploaded, further uploads are disabled until a page refresh.
Initial Setup
- Clone the repository: Clone this repository using
git clone. - Download Dependencies: download dependencies using
npm.
git clone https://github.com/ergolyam/temp-file-sharing
cd temp-file-sharing
npm install
Deploy
-
Run:
npm start -
Other working env's:
PORT=3000 FILE_RETENTION="30" FILE_SIZE_LIMIT="10" PUBLIC_DOMAIN="example.com" UPLOAD_LIMIT="5"
Container
-
Pull container:
podman pull ghcr.io/ergolyam/temp-file-sharing:latest -
Deploy in container
podman run --tmpfs /tmp -d \ --name temp-file-sharing \ -p 3000:3000 \ -e PORT="3000" \ ghcr.io/ergolyam/temp-file-sharing:latest
Proxy on nginx
Routing Based on Hostname
- Create a file /etc/nginx/sites-enabled/example.com with the lines:
server { listen 80 default; server_name example.com; location / { proxy_pass http://127.0.0.1:3000/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; client_max_body_size 0; } }
Routing Based on URL Path
- Create a file /etc/nginx/sites-enabled/example.com with the lines:
server { listen 80 default; server_name example.com; location /shared/ { proxy_set_header X-Forwarded-Prefix /shared; proxy_pass http://127.0.0.1:3000/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; client_max_body_size 0; } }
Features
-
Multiple Upload Methods:
Drag & drop, file selection, and clipboard paste support. -
Temporary File Storage:
Files are stored in/tmp/temp-filesand automatically deleted after a configurable retention period. -
Download Link Generation:
Each upload generates a unique download link. -
Anti-Spam Protection:
Limits the number of uploads from a single IP within a 5‑minute window. Excessive uploads result in a temporary block. -
Proxy Friendly:
Supports Nginx proxy configuration by usingapp.set('trust proxy', true)and thePUBLIC_DOMAINenvironment variable. -
Client UI:
Once a file is uploaded, the drag & drop zone is removed and the download link along with the original file name is displayed.