kn-lan-share
v0.1.3
Published
Lightweight HTTP server for local file sharing across your network with QR code access, upload/download capabilities, and smart network detection
Maintainers
Readme
KN-Lan-Share
A lightweight, feature-rich command-line HTTP server for local file sharing and transfer across your network.
🚀 Quick Start
# Install globally
npm install -g kn-lan-share
# Start the server
klsThat's it! Your file server is now running and accessible from any device on your local network.
📋 Table of Contents
📦 Installation
Global Installation (Recommended)
npm install -g kn-lan-shareLocal Development
# Clone the repository
git clone <repository-url>
cd kn-lan-share
# Install dependencies
npm install
# Build the project
npm run build
# Run the server
npm start🎯 Usage
Basic Usage
# Start server on default port (3000)
kls
# The server will display:
# - Server host address
# - Active network interface IP
# - Access URL for other devicesWith Custom Port
kls -p 8080With Custom IP Binding
kls -a 192.168.1.100Enable File Uploads
kls -upShow QR Code
kls -qrCombined Options
kls -p 8080 -up true -qr🎛️ Command-Line Options
| Flag | Description | Default | Example |
| -------------- | --------------------------------------------------- | ------- | ---------------------- |
| -p <port> | Custom port number | 3000 | kls -p 8080 |
| -a <address> | Bind to specific IP address | 0.0.0.0 | kls -a 192.168.1.100 |
| -hw <bytes> | High water mark for streams (1 to 1073741824 bytes) | Default | kls -hw 65536 |
| -qr | Display QR code in terminal | false | kls -qr |
| -up | Enable/disable file uploads | false | kls -up true |
🔒 Security Considerations
Upload Protection
By default, file uploads are disabled to protect your system from unauthorized file writes. To enable uploads:
kls -upNetwork Exposure
The server binds to 0.0.0.0 by default, making it accessible from any device on your network. To restrict access:
# Bind to localhost only
kls -a 127.0.0.1
# Bind to specific network interface
kls -a 192.168.1.100Recommended Practices
- Only enable uploads (
-up true) when you need to receive files - Use on trusted networks only
- Monitor the terminal for access logs
- Stop the server when not in use
📖 Examples
Example 1: Personal File Server
# Start server with QR code for easy mobile access
kls -qrScan the QR code with your phone to instantly access files!
Example 2: Team File Sharing with Uploads
# Start on custom port with uploads enabled
kls -p 3000 -upShare the URL with your team to both download and upload files.
Example 3: Optimized Streaming
# Start with custom buffer size for large file transfers
kls -hw 131072Adjust the high water mark for optimal performance with large files.
Example 4: Development Server
# Bind to localhost only for local testing
kls -a 127.0.0.1 -p 3000🤝 Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
📄 License
ISC License - See LICENSE file for details
👨💻 Author
knkrn5
🙏 Acknowledgments
- Built with Node.js native modules for zero-dependency runtime
- Uses
qrcode-terminalfor QR code generation
Made with ❤️ for easy local file sharing
