terabox-upload-tool
v1.4.1
Published
A robust library designed for seamless integration with TeraBox, the leading cloud storage service offering 1 TB of free space. Effortlessly upload files, download files, delete files, manage directories, and retrieve file lists. Ideal for developers seek
Maintainers
Readme
Terabox Upload Tool
A robust Node.js library for seamless integration with TeraBox. Effortlessly upload, download, manage files and directories, and retrieve file lists.
Features
- Automated Upload Flow: Handles
precreate, MD5 calculation, and finalization automatically. - File Management: Create directories, move, rename, and delete files.
- Downloads: Generate direct download links (
dlink). - Sharing: Generate short URLs for file sharing.
- Latest API Support: Includes
jsToken,dp-logid, andappIdsupport to bypass modern restrictions.
Installation
npm install terabox-upload-toolSetup & Credentials
To use this library, you need to extract three key parameters from your browser while logged into TeraBox:
- ndus: Found in your Browser Cookies (
Application->Cookies->https://www.terabox.com). - jsToken: Found in the response or query parameters of API calls (e.g.,
api/listorapi/home/info) in theNetworktab. - appId: Usually
250528, but verify by looking at theapp_idparameter in any API request in theNetworktab.
Usage
Initialization
const TeraboxUploader = require('terabox-upload-tool');
const uploader = new TeraboxUploader({
ndus: "YOUR_NDUS",
jsToken: "YOUR_JS_TOKEN",
appId: "250528",
bdstoken: "OPTIONAL",
browserId: "OPTIONAL"
});API Methods
Upload File
const result = await uploader.uploadFile('./myfile.txt', (loaded, total) => {
console.log(`Progress: ${Math.round((loaded / total) * 100)}%`);
}, '/remote/dir');Download File
const result = await uploader.downloadFile(fs_id);
console.log('Download Link:', result.downloadLink);File List
const result = await uploader.fetchFileList('/remote/dir');
console.log(result.data.list);Directory Operations
await uploader.createDirectory('/new_folder');
await uploader.moveFiles('/old/path.txt', '/new/dir', 'newname.txt');
await uploader.deleteFiles(['/file_to_delete.txt', '/folder_to_delete']);Sharing
const result = await uploader.generateShortUrl('/path/file.txt', fs_id);
console.log('Short URL:', result.shortUrl);License
MIT
