quark2baidu
v2.0.1
Published
Cross-platform CLI for moving files from Quark Cloud Drive to Baidu Netdisk.
Maintainers
Readme
Q2B - Quark2Baidu
A careful cross-platform CLI for moving files from Quark Cloud Drive to Baidu Netdisk.
Q2B starts as a focused Quark -> Baidu transfer tool and is being shaped into a clean cloud-to-cloud migration project. It is designed for two audiences at once: non-developers who want a guided command, and developers who want a readable, testable codebase.
Project page · Issues · License
What It Does
- Transfers selected files from Quark Cloud Drive to Baidu Netdisk.
- Uses Baidu rapid upload first when the server-side cache can match the file.
- Falls back to normal multipart upload when rapid upload misses, unless disabled.
- Preserves folder structure when selecting folders recursively.
- Stores cookies locally in the operating system user config directory.
- Runs on Windows, macOS, and Linux with Node.js and npm.
Install
Install from npm:
npm install -g quark2baiduYou can also run from GitHub source:
git clone https://github.com/chang-xinhai/Quark2Baidu.git
cd Quark2Baidu
npm install
npm link
q2b doctorQuick Start
Save cookies and defaults:
q2b setupVerify the local environment and current login state:
q2b doctor --onlineStart the interactive transfer flow:
q2b
The CLI will open a Quark file picker, let you select files or folders, then transfer to your configured Baidu target folder.
Getting Cookies
Q2B talks directly to Quark and Baidu from your machine, so it needs your browser cookies.
Recommended browser extension flow:
- Install Cookie-Editor for Chrome or Edge.
- Log in to Quark Cloud Drive and Baidu Netdisk.
- Open Cookie-Editor on each site.
- Export as
Header String. - Paste the full string into
q2b setup.
Developer tools flow:
- Log in to the target website.
- Open DevTools, then the Network panel.
- Refresh the page.
- Select a list/sort request.
- Copy the full
Cookierequest header value.
Commands
q2b # choose files and start transfer
q2b transfer # same as q2b
q2b setup # save cookies and defaults
q2b doctor # inspect local config
q2b doctor --online # validate Quark and Baidu login state
q2b config path # print active config file path
q2b config show # print redacted configUseful flags:
q2b --target /Q2B/Archive/
q2b --concurrency 5
q2b --no-fallback-upload
q2b --config ./local.config.jsonConfiguration
Default config locations:
- macOS:
~/Library/Application Support/q2b/config.json - Windows:
%APPDATA%\q2b\config.json - Linux:
~/.config/q2b/config.json
The config file is written with restrictive permissions where the operating system supports it.
Environment variable overrides:
Q2B_QUARK_COOKIE="..." Q2B_BAIDU_COOKIE="..." q2b doctor --online
Q2B_CONFIG=/path/to/config.json q2b
Q2B_DEBUG=1 q2bConfig shape:
{
"quarkCookie": "",
"baiduCookie": "",
"targetPath": "/Q2B/",
"concurrency": 3,
"chunkSize": 262144,
"fallbackUpload": true,
"verifySsl": true
}Safety Model
Q2B is local-first:
- It does not run a hosted backend.
- It does not collect telemetry.
- It does not send cookies anywhere except Quark and Baidu requests made by your local process.
- Diagnostic output redacts cookie values.
- Remote paths are normalized and checked before upload requests.
- Temporary fallback-upload files are deleted after each task.
Important limits:
- Cookies are sensitive credentials. Treat them like passwords.
- Baidu rapid upload depends on server-side file availability and can fail for normal reasons.
- Fallback upload may download the source file to local temporary storage before uploading it to Baidu.
- Platform APIs and web cookies can change without notice.
Developer Workflow
npm install
npm run check
npm test
node ./bin/q2b.js --helpProject layout:
bin/q2b.js npm executable entry
src/cli.js command routing
src/transfer.js interactive picker and transfer orchestration
src/clients/quark.js Quark API client
src/clients/baidu.js Baidu API client
src/config.js config loading, saving, redaction
src/paths.js remote path validation helpers
docs/ GitHub Pages product site
Q2B.py legacy Python implementationLegacy Python Entry
The original Python script is still kept for users who already rely on it:
pip install httpx prompt_toolkit tqdm
python Q2B.pyNew development should target the npm CLI unless a change specifically concerns the legacy Python path.
Roadmap
- Current: stable Quark -> Baidu CLI with recursive selection and fallback upload.
- Next: resumable transfer state, richer retry policy, and structured transfer reports.
- Later: provider adapter interfaces for more netdisks.
- Long term: migration between any two supported cloud drives.
Disclaimer
This project is for personal data migration, learning, and interoperability experiments. Use it only with files and accounts you are allowed to operate. Follow Quark, Baidu, and local law/service terms. You are responsible for account, data, and copyright risk.
License
MIT. See LICENSE.
