Dev.to CLI Image Upload via Terminal
说明与用途
DevPub 的 devpub upload 命令让用户可以直接从终端上传图片到 Dev.to,取代了手动使用网页编辑器的流程。
问题
The Forem API lacks an image upload endpoint, forcing Dev.to users to manually upload images through the web editor and copy URLs into markdown.
结果
The PR added a robust, well‑tested image uploader that handles authentication via session cookie and CSRF token, validates files before network calls, and parses varied response shapes. Users can now upload images from the terminal in a single command.
工作流
- 1. Install devpub v0.3
- 2. Export session cookie and CSRF token to .devpub/.env
- 3. Run
devpub upload cover.pngto upload a single image - 4. Run
devpub upload *.png --markdownto get markdown tags - 5. Optionally use
--dry-runto validate paths
证据
devpub upload cover.png
Uploaded: cover.png
Uploaded Images
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
- 记录日期: 2026-09-07T18:22:42.567Z