Helia Documentation

repository·main·Indexed 23 days ago

https://github.com/ipfs/helia

A lean, modular, and modern TypeScript implementation of IPFS designed for JavaScript and browser environments. The project includes core IPFS functionality and specialized packages such as @helia/bitswap for the Bitswap protocol, @helia/car for importing and exporting CAR files, and @helia/dag-cbor for DAG-CBOR data blocks.

Tokens
66.4K
Snippets
149
Records
403
Agent score
78%

What's inside Helia

  1. Overview of @helia/bitswap

    main
    @helia/bitswap is a TypeScript implementation of the Bitswap protocol. It is designed to be a modern replacement for the older ipfs-bitswap module, offering a smaller footprint, faster performance, better integration with libp2p and helia, fewer dependencies, and a reliance on standard JavaScript instead of Node.js-specific APIs.
  2. Overview of Helia's purpose and target environments

    main

    Helia is a focused, modular, and opinionated JavaScript-native implementation of the IPFS (Interplanetary File System) protocol. It is written in TypeScript/JavaScript and is designed to run in a wide variety of environments, including:

    • Web browsers
    • Service workers
    • Browser extensions
    • Node.js
    • Virtually any environment where JavaScript can execute.
  3. What is @helia/fallback-router?

    main

    @helia/fallback-router is a Helia router that yields hard-coded providers.

    It enables Helia to fallback to using a trustless gateway to fetch content from peers that support transports not available in the current Helia environment. For example, it allows browser-based peers to fetch content from network nodes that only support TCP or QUIC connections.

  4. Interpret transport benchmark results

    main

    When analyzing the benchmark results:

    • Lower numbers are better: The metrics represent performance costs (e.g., time or resources).
    • Direction of transfer: The legend arrow indicates the flow of data. For example, helia -> kubo represents a workflow where ipfs.add is executed on Helia and ipfs.pin is executed on Kubo to pull that data from Helia.
  5. Understand transfer benchmark results and directionality

    main

    When interpreting the benchmark results and generated graphs:

    • Metric Direction: Lower numbers indicate better performance.
    • Transfer Direction: The legend arrow indicates the direction of data transfer. For example, helia -> kubo represents a workflow where:
      1. ipfs.add is executed on Helia.
      2. ipfs.cat is executed on Kubo, which pulls the data from Helia.
  6. Understand Helia's modular architecture

    main

    Helia is designed to be modular, allowing developers to mix and match different implementations of the Helia API.

    Core implementations include:

    • @packages/helia: A peer-to-peer implementation using Bitswap, libp2p, and HTTP gateways as fallback.
    • @packages/http: A lightweight implementation using HTTP gateways exclusively.

    Users can extend functionality by adding supplemental libraries such as @helia/dag-cbor, @helia/dag-json, @helia/unixfs, and others to suit their specific application needs.

  7. Delegated Routing via HTTP Routing v1

    main

    For applications that need to delegate routing (rather than performing DHT queries directly from a browser), Helia supports the HTTP Routing v1 protocol.

    While this protocol uses HTTP as a transport, it is a specified standard and is not tied to the Kubo RPC API. Developers can configure HTTP Routing v1 endpoints to handle delegated routing tasks.

  8. Use @helia/strings via Browser `<script>` tag

    main

    You can load @helia/strings directly in the browser using a script tag. The module's exports will be available under the global HeliaStrings namespace.

    <script src="https://unpkg.com/@helia/strings/dist/index.min.js"></script>