0.1.3 • Published 11 months ago

bs-file-downloader v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Block Stream File Downloader

Chinese Version (中文版)

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

  • 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

  1. Clone the repository:
git clone https://github.com/Travisun/Block-Stream-File-Downloader.git
cd Block-Stream-File-Downloader
  1. Install dependencies:
npm install
  1. 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

  1. Ensure that Rust and Node.js are installed in your development environment.

  2. Install wasm-pack:

cargo install wasm-pack
  1. Run the following command in the project root directory to build the WebAssembly module:
wasm-pack build --target web
  1. After modifying the Rust code, re-run the above command to rebuild.

  2. Use npm run build to build the JavaScript wrapper.

Packaging Instructions

  1. Update the version numbers in Cargo.toml and package.json.

  2. Build the WebAssembly module:

wasm-pack build --target web
  1. Build the npm package:
npm run build
  1. 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:

  1. MIT License
  2. User Agreement
  3. Disclaimer

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

  1. 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.

  2. Users must comply with all usage restrictions and conditions specified in the user agreement.

  3. 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.

  4. 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:


© 2024 Block Stream File Downloader Team, Investravis Team. All rights reserved.

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago