File Upload CLI Tool
A Node.js command-line tool for uploading files to the litterbox.catbox.moe file sharing service using curl.
Quick Start
Upload a file and receive a shareable URL:
CODEBLOCK0
Example:
CODEBLOCK1
Output:
CODEBLOCK2
Instructions
Step 1: Installation
Ensure Node.js v14+ and curl are installed:
Requirements:
- - Node.js v14+
- curl (included in Windows 10+, macOS, and most Linux distributions)
CODEBLOCK3
Step 2: Upload a File
Run the CLI tool with a file path:
CODEBLOCK4
Path Types:
- - Relative: INLINECODE0
- Absolute:
node file-upload-cli.js /home/user/file.txt (Unix) or node file-upload-cli.js C:\Users\user\file.txt (Windows) - With spaces: INLINECODE3
Step 3: Use the URL
The tool outputs a shareable URL that can be:
- - Shared with others
- Embedded in documents
- Used in applications
URL Format: INLINECODE4
Examples
Upload Different File Types
Text file:
CODEBLOCK5
Image:
CODEBLOCK6
PDF document:
CODEBLOCK7
Archive:
CODEBLOCK8
Large Files with Progress
For files larger than 1MB, the tool displays upload progress:
CODEBLOCK9
Output:
CODEBLOCK10
Cross-Platform Paths
Windows:
CODEBLOCK11
macOS/Linux:
CODEBLOCK12
Error Handling
The tool provides clear error messages for common issues:
Validation Errors (Exit Code 4)
No file path provided:
CODEBLOCK13
File not found:
CODEBLOCK14
Path is a directory:
CODEBLOCK15
File too large:
CODEBLOCK16
Empty file:
CODEBLOCK17
Network Errors (Exit Code 2)
Connection failure:
CODEBLOCK18
Timeout:
CODEBLOCK19
Service Errors (Exit Code 3)
File too large (service rejection):
CODEBLOCK20
Server error:
CODEBLOCK21
Service unavailable:
CODEBLOCK22
Security Considerations
File Access
- - The tool only reads the file you specify
- No directory traversal or unauthorized file access
- Files are not modified or deleted
- File path validation prevents malicious inputs
Network Security
- - Only communicates with
https://litterbox.catbox.moe (HTTPS encrypted) - Uses system curl command for secure file transmission
- No other external services are contacted
- No authentication tokens or API keys required
- Secure TLS connection for file transmission
Data Privacy
⚠️
Important: Files are uploaded to a
public file sharing service:
- - URLs are publicly accessible by anyone who has the link
- Files automatically expire after 72 hours
- No authentication or access control
- Do not upload sensitive, confidential, or private files
- User is responsible for file content and compliance
Dependencies
The tool uses:
- - Native Node.js modules:
child_process, fs, path, INLINECODE9 - System curl: Pre-installed on most systems, widely trusted and security-audited
- No external npm packages required
Limitations
- - Maximum file size: 1GB (litterbox.catbox.moe service limit)
- File expiry: Files are automatically deleted after 72 hours
- Upload timeout: 60 seconds
- Single file: One file per command (no batch uploads)
- No retry logic: Failed uploads must be manually retried
- Public URLs: All uploaded files are publicly accessible
- Requires curl: System must have curl installed
Technical Details
Implementation: file-upload-cli.js (Node.js script)
Exit Codes:
- -
0: Success - INLINECODE12 : General error
- INLINECODE13 : Network error
- INLINECODE14 : Service error
- INLINECODE15 : Validation error
Requirements:
- - Node.js v14.0.0 or higher
- Internet connection
- Read access to the file being uploaded
Troubleshooting
"curl command not found"
- - Install curl on your system (included in Windows 10+, macOS, most Linux distributions)
"Permission denied"
- - Check file permissions:
chmod +r file.txt (Unix) - Ensure you have read access to the file
"Connection timeout"
- - Check internet connection
- Try again with a smaller file
- Verify firewall allows HTTPS connections
"Service error"
- - The litterbox.catbox.moe service may be temporarily down
- Wait a few minutes and try again
- Check service status at https://catbox.moe
文件上传命令行工具
一个使用curl将文件上传至litterbox.catbox.moe文件共享服务的Node.js命令行工具。
快速开始
上传文件并获取可分享的URL:
bash
node file-upload-cli.js <文件路径>
示例:
bash
node file-upload-cli.js document.pdf
输出:
正在上传...
文件上传成功!
URL: https://litter.catbox.moe/abc123.pdf
注意:文件将在72小时后失效。
使用说明
第一步:安装
确保已安装Node.js v14+和curl:
系统要求:
- - Node.js v14+
- curl(Windows 10+、macOS及大多数Linux发行版已预装)
bash
cd file-upload-cli
npm install # 无需外部依赖
第二步:上传文件
使用文件路径运行命令行工具:
bash
node file-upload-cli.js <文件路径>
路径类型:
- - 相对路径:node file-upload-cli.js ./file.txt
- 绝对路径:node file-upload-cli.js /home/user/file.txt(Unix)或 node file-upload-cli.js C:\Users\user\file.txt(Windows)
- 含空格路径:node file-upload-cli.js my file.txt
第三步:使用URL
工具会输出一个可分享的URL,可用于:
URL格式:https://0x0.st/<随机ID>
示例
上传不同文件类型
文本文件:
bash
node file-upload-cli.js notes.txt
图片:
bash
node file-upload-cli.js photo.jpg
PDF文档:
bash
node file-upload-cli.js report.pdf
压缩包:
bash
node file-upload-cli.js backup.zip
大文件上传进度
对于超过1MB的文件,工具会显示上传进度:
bash
node file-upload-cli.js large-video.mp4
输出:
正在上传...
文件上传成功!
URL: https://litter.catbox.moe/xyz789.mp4
注意:文件将在72小时后失效。
跨平台路径
Windows:
bash
node file-upload-cli.js C:\Users\user\Documents\file.pdf
node file-upload-cli.js .\file.txt
macOS/Linux:
bash
node file-upload-cli.js /home/user/documents/file.pdf
node file-upload-cli.js ./file.txt
错误处理
工具针对常见问题提供清晰的错误信息:
验证错误(退出码4)
未提供文件路径:
错误:未提供文件路径
用法:node file-upload-cli.js <文件路径>
文件未找到:
错误:文件未找到 - /path/to/file.txt
请检查文件路径后重试。
路径为目录:
错误:路径为目录 - /path/to/folder
请提供文件路径,而非目录路径。
文件过大:
错误:文件过大 - 1.5 GB(限制:1 GB)
文件超出litterbox.catbox.moe服务限制。
空文件:
错误:文件为空 - /path/to/file.txt
无法上传空文件。
网络错误(退出码2)
连接失败:
错误:网络错误 - 无法连接到litterbox.catbox.moe
请检查网络连接后重试。
超时:
错误:连接超时
上传请求超时,请重试。
服务错误(退出码3)
文件过大(服务拒绝):
错误:服务错误 - 文件过大(413)
litterbox.catbox.moe服务拒绝了该文件,最大大小为1 GB。
服务器错误:
错误:服务错误 - 内部服务器错误(500)
litterbox.catbox.moe服务遇到错误,请稍后重试。
服务不可用:
错误:服务不可用(503)
litterbox.catbox.moe服务暂时不可用,请稍后重试。
安全注意事项
文件访问
- - 工具仅读取您指定的文件
- 不会进行目录遍历或未授权文件访问
- 不会修改或删除文件
- 文件路径验证可防止恶意输入
网络安全
- - 仅与https://litterbox.catbox.moe通信(HTTPS加密)
- 使用系统curl命令进行安全文件传输
- 不联系其他外部服务
- 无需身份验证令牌或API密钥
- 文件传输使用安全的TLS连接
数据隐私
⚠️
重要提示:文件将上传至
公共文件共享服务:
- - 任何拥有链接的人均可公开访问URL
- 文件在72小时后自动过期
- 无身份验证或访问控制
- 请勿上传敏感、机密或私人文件
- 用户需对文件内容及合规性负责
依赖项
该工具使用:
- - 原生Node.js模块:child_process、fs、path、util
- 系统curl:大多数系统已预装,广泛信任且经过安全审计
- 无需外部npm包
限制
- - 最大文件大小:1GB(litterbox.catbox.moe服务限制)
- 文件有效期:文件在72小时后自动删除
- 上传超时:60秒
- 单文件:每次命令仅上传一个文件(不支持批量上传)
- 无重试机制:上传失败需手动重试
- 公共URL:所有上传文件均可公开访问
- 需要curl:系统必须安装curl
技术细节
实现方式:file-upload-cli.js(Node.js脚本)
退出码:
- - 0:成功
- 1:一般错误
- 2:网络错误
- 3:服务错误
- 4:验证错误
系统要求:
- - Node.js v14.0.0或更高版本
- 网络连接
- 对上传文件的读取权限
故障排除
curl命令未找到
- - 在系统中安装curl(Windows 10+、macOS、大多数Linux发行版已预装)
权限被拒绝
- - 检查文件权限:chmod +r file.txt(Unix)
- 确保您对文件有读取权限
连接超时
- - 检查网络连接
- 尝试上传较小的文件
- 确认防火墙允许HTTPS连接
服务错误
- - litterbox.catbox.moe服务可能暂时不可用
- 等待几分钟后重试
- 访问https://catbox.moe查看服务状态