@snoggin-io/file-server
v1.0.0
Published
A simple, lightweight file upload server with a beautiful web interface and REST API
Maintainers
Readme
📁 File Server
A simple, lightweight file upload server with a beautiful web interface and REST API. Perfect for temporary file sharing, testing, and development workflows.
✨ Features
- 🌐 Web Interface - Beautiful HTML upload form at
http://localhost:3000 - 🔗 REST API - Simple POST endpoint for programmatic uploads
- 📂 Original Filenames - Preserves original file names
- 🗂️ Temporary Storage - Uses system temp directory with auto-cleanup
- 🎨 Modern UI - Responsive design with real-time feedback
- 🔒 ISC License - Permissive open-source license
🚀 Quick Start
Using npx (Recommended)
npx @snoggin-io/file-serverNo installation required! Starts immediately.
Global Installation
npm install -g @snoggin-io/file-server
file-serverLocal Installation
npm install @snoggin-io/file-server
npx @snoggin-io/file-serverFrom Source
git clone https://github.com/snoggin-io/file-server.git
cd file-server
npm install
npm start📖 Usage
Web Interface
Start the server:
npx @snoggin-io/file-serverOpen your browser to
http://localhost:3000Select a file and click "Upload File"
Get an instant shareable URL
API Usage
Upload a file via curl:
curl -X POST -F "[email protected]" http://localhost:3000/uploadResponse:
{
"filename": "document.pdf",
"url": "http://localhost:3000/files/document.pdf"
}Environment Variables
PORT- Server port (default: 3000)
Example:
PORT=8080 npx @snoggin-io/file-server🔧 API Reference
POST /upload
Upload a file via multipart form-data.
Request:
- Method:
POST - Content-Type:
multipart/form-data - Body: File with key
file
Response:
{
"filename": "example.pdf",
"url": "http://localhost:3000/files/example.pdf"
}Error Response:
{
"error": "No file uploaded"
}GET /files/:filename
Download or view an uploaded file.
Request:
- Method:
GET - Path:
/files/{filename}
Response:
- File content with appropriate headers
GET /
Access the web upload interface.
🏗️ Architecture
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Web Browser │────│ File Server │────│ Temp Directory │
│ │ │ │ │ │
│ Upload Form │ │ Express.js │ │ /tmp/file- │
│ File Display │ │ Multer │ │ server-xxxxx/ │
└─────────────────┘ └─────────────────┘ └─────────────────┘📁 File Storage
- Files are stored in a unique temporary directory
- Directory path:
/tmp/file-server-{random}/(Linux/macOS) or%TEMP%\file-server-{random}\(Windows) - Auto-cleanup: Directory is removed when server shuts down
- Collision handling: Files with same name will overwrite previous uploads
🔒 Security Considerations
- Files are stored temporarily and cleaned up on exit
- No authentication or authorization
- Intended for development and testing environments
- Not recommended for production without additional security measures
🛠️ Development
Prerequisites
- Node.js 14+
- npm or yarn
Setup
git clone https://github.com/snoggin-io/file-server.git
cd file-server
npm installScripts
npm start # Start development server with ts-node
npm run build # Build TypeScript to JavaScriptProject Structure
file-server/
├── src/
│ └── index.ts # Main server code
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md📦 Dependencies
- express - Web framework
- multer - File upload middleware
- @types/express - TypeScript definitions
- @types/multer - TypeScript definitions
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the ISC License - see the LICENSE file for details.
🙋♂️ Support
- 📫 Create an issue for bug reports or feature requests
- ⭐ Star the repository if you find it useful
- 🔄 Share with others who might benefit
🗂️ Use Cases
- Quick File Sharing - Share files instantly without cloud storage accounts
- Development Testing - Test file upload functionality in applications
- Temporary File Hosting - Host files temporarily for demos or testing
- CI/CD Pipelines - File transfer in automated workflows
- Local Development - Mock file upload services during development
- Prototyping - Quick file handling for prototypes and POCs
- Cross-device Transfer - Transfer files between devices on same network
Made with ❤️ using Node.js and TypeScript
