DataTape is a file or stream that consists of a sequence of Data packets. This type implements DataStore interfaces on top of such a file or stream.

Implements

Constructors

  • Constructor.

    Parameters

    • stream:
          | string
          | ReadableStream
          | WritableStream
          | OpenStream

      Stream or how to open the stream.

    Returns DataTape

    stream could be:

    • a readable/writable stream;
    • a function to (re)open the stream;
    • a filename.

    DataTape.Reader methods are available only if the stream is readable. DataTape.Writer methods are available only if the stream is writable.

    If stream is a stream instance, it allows either one read or multiple writes. If stream is an opener function or filename, it allows multiple reads and writes. Function calls must be sequenced because this type is non-thread-safe.

Methods

  • Returns Promise<void>

  • Find Data that satisfies Interest.

    Parameters

    Returns Promise<undefined | Data>

  • Retrieve Data by exact name.

    Parameters

    Returns Promise<undefined | Data>

  • Insert one or more Data packets.

    Parameters

    • Rest...args: (Data | AnyIterable<Data>)[] | [{}, ...(Data | AnyIterable<Data>)[]]

    Returns Promise<void>

    Arguments include:

    • an optional Options object
    • zero or more Data, Iterable, or AsyncIterable
  • List Data packets, optionally filtered by name prefix.

    Parameters

    • Optionalprefix: Name

    Returns AsyncIterable<Data>

  • List Data names, optionally filtered by name prefix.

    Parameters

    • Optionalprefix: Name

    Returns AsyncIterable<Name>