bs-file-downloader
v0.1.3
Published
A block stream file downloader using WebAssembly
Downloads
2
Maintainers
Readme
Block Stream File Downloader
Block Stream File Downloader is an efficient, memory-friendly large file downloader implemented using WebAssembly. It utilizes a block streaming method to effectively handle large files while maintaining low memory usage. It is not suitable for ordinary file downloads but is specifically designed for downloading files stored in Block Stream format.
Table of Contents
- Features
- Installation
- Usage
- Development Guide
- Packaging Instructions
- Legal and Agreements
- Contributing
- Contact
Features
- WebAssembly-based, providing high-performance file downloads
- Uses block streaming processing, supporting large file downloads
- Low memory usage, suitable for various environments
- Supports multi-source downloads, improving download speed and stability
- Built-in integrity checks to ensure downloaded file correctness
Installation
Using as an npm package
npm install bs-file-downloader
Building from source
- Clone the repository:
git clone https://github.com/Travisun/Block-Stream-File-Downloader.git
cd Block-Stream-File-Downloader
- Install dependencies:
npm install
- Build the project:
npm run build
Usage
import { BsFileDownloaderWrapper } from 'bs-file-downloader';
async function downloadFile() {
const downloader = new BsFileDownloaderWrapper();
await downloader.initialize();
downloader.setBaseUrls(['https://example.com/files', 'https://backup.example.com/files']);
const bsContent = '...'; // .bs file content
try {
const result = await downloader.downloadAndVerify(bsContent);
console.log('Download completed:', result);
} catch (error) {
console.error('Download failed:', error);
}
}
downloadFile();
For detailed API documentation, please refer to API.md.
Development Guide
Ensure that Rust and Node.js are installed in your development environment.
Install wasm-pack:
cargo install wasm-pack
- Run the following command in the project root directory to build the WebAssembly module:
wasm-pack build --target web
After modifying the Rust code, re-run the above command to rebuild.
Use
npm run build
to build the JavaScript wrapper.
Packaging Instructions
Update the version numbers in
Cargo.toml
andpackage.json
.Build the WebAssembly module:
wasm-pack build --target web
- Build the npm package:
npm run build
- Publish the npm package:
npm publish
Legal and Agreements
This project is governed by multiple legal documents. By using, modifying, or distributing this software, you agree to comply with all of the following agreements:
Please read all of these documents carefully before using this software. Together, they constitute the complete legal framework for the use of this software.
Special Considerations
This software must not be used for any illegal purposes, including but not limited to actions that violate the laws and regulations of China, the United States, or other applicable jurisdictions.
Users must comply with all usage restrictions and conditions specified in the user agreement.
When modifying, redistributing, using, or referencing this software in any form, all original agreement files must be retained and provided in full, including the user agreement, disclaimer, and license.
This software is provided "as is" without any form of warranty. The authors and copyright holders are not responsible for any losses caused by the use of this software.
Please carefully read all relevant agreement files before using this software. If you do not agree to these terms, please do not use this software.
Contributing
We welcome and appreciate any form of contribution. Before submitting a Pull Request, please make sure you have read and agreed to our Contribution Guidelines.
Contact
If you have any questions or suggestions, please contact us through:
- Issue Tracker: GitHub Issues
- Email: [email protected]
© 2024 Block Stream File Downloader Team, Investravis Team. All rights reserved.