• Public
  • Public/Protected
  • All

Module segmented-object


This package is part of NDNts, Named Data Networking libraries for the modern web.

This package implements functions to publish and retrieve segmented objects. @ndn/cat package is a command line program that uses this package, and serves as an example.

The consumer functionality:

  • supports version discovery via CanBePrefix.
  • supports version discovery via RDR protocol (in @ndn/rdr package).
  • supports manifest.
  • allows specifying segment range.
  • supports segment numbers.
  • supports byte offsets.
  • supports multiple naming conventions.
  • has Interest pipelining, congestion control, and loss recovery.
  • verifies packets with a Verifier (fixed key or trust schema).
  • emits events as segments arrive.
  • outputs in-order data chunks as a readable stream.
  • outputs completely reassembled object via Promise.

The producer functionality:

  • takes input from Uint8Array.
  • takes input from readable streams.
  • takes input from files (filename in Node.js, Blob in browser).
  • generates segments of fixed size.
  • generates segments of available data as Interest arrives, to minimize delivery latency.
  • responds to version discovery Interests with CanBePrefix.
  • responds to RDR protocol (in @ndn/rdr package).
  • generates manifest.
  • supports segment numbers.
  • supports byte offsets.
  • supports multiple naming conventions.
  • signs packets with a Signer (fixed key or trust schema).
  • reports when all segments have been retrieved at least once.


Type aliases

ChunkOptions: ChunkSizeRange | ChunkSizeExact

Chunk sizing options.

ServeOptions: DataProducer.Options & { announcement?: Endpoint.RouteAnnouncement; describe?: string; endpoint?: Endpoint; producerPrefix?: Name }

Options to serve().

ServeVersionedOptions: ServeOptions & (GivenVersionOptions | MakeVersionOptions)

Options to serveVersioned().


StreamChunkSource: typeof IterableChunkSource = IterableChunkSource

Alias of IterableChunkSource, which accepts NodeJS stream.Readable.


  • Start serving a segmented object.


    • prefixInput: NameLike

      Data prefix excluding segment number.

    • source: ChunkSource

      where to read segment payload chunks.

    • opts: ServeOptions = {}

      other options.

      This function does not automatically add a version component to the name prefix. If a version component is desired, use serveVersions() function instead.

    Returns Server

Generated using TypeDoc