Nippy File Share Page
const fileId = path.parse(file.filename).name; const expiryTime = calculateExpiry(expiry); fileStore.set(fileId, originalName: file.originalname, filename: file.filename, size: file.size, mimetype: file.mimetype, uploadTime: new Date(), expiryTime: expiryTime, downloads: 0 ); res.json( success: true, fileId: fileId, downloadUrl: `/download/$fileId`, expiry: expiryTime ); catch (error) res.status(500).json( error: error.message );
<div class="features"> <div class="feature"> <span class="feature-icon">⚡</span> <h3>Lightning Fast</h3> <p>Optimized for speed with minimal latency</p> </div> <div class="feature"> <span class="feature-icon">🔒</span> <h3>Secure</h3> <p>End-to-end encrypted file transfer</p> </div> <div class="feature"> <span class="feature-icon">⏰</span> <h3>Temporary</h3> <p>Files auto-expire for privacy</p> </div> </div> </div>
// Routes app.post('/upload', upload.single('file'), (req, res) => try const file = req.file; const expiry = '24h' = req.body; nippy file share
.btn-primary background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white;
.btn-primary:hover transform: translateY(-2px); box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4); const fileId = path
const filePath = path.join('./uploads', fileInfo.filename);
// Event Listeners uploadArea.addEventListener('click', () => fileInput.click()); uploadArea.addEventListener('dragover', handleDragOver); uploadArea.addEventListener('dragleave', handleDragLeave); uploadArea.addEventListener('drop', handleDrop); fileInput.addEventListener('change', handleFileSelect); uploadBtn.addEventListener('click', () => fileInput.click()); copyBtn.addEventListener('click', copyShareUrl); newUploadBtn.addEventListener('click', resetUpload); const fileId = path.parse(file.filename).name
// Fetch file info try const infoResponse = await fetch(`$API_BASE/info/$response.fileId`); const fileInfoData = await infoResponse.json(); fileInfo.innerHTML = ` <p><strong>Filename:</strong> $fileInfoData.originalName</p> <p><strong>Size:</strong> $fileInfoData.size</p> <p><strong>Expires:</strong> $new Date(fileInfoData.expiryTime).toLocaleString()</p> <p><strong>Downloads:</strong> $fileInfoData.downloads</p> `; catch (error) console.error('Error fetching file info:', error);