McapWriter provides an interface for writing messages to MCAP files.

NOTE: callers must wait on any method call to complete before calling another method. Calling a method before another has completed will result in a corrupt MCAP file.

Hierarchy

  • McapWriter

Constructors

Properties

#appendMode: boolean = false
#attachmentIndices: undefined | AttachmentIndex[]
#channels: Map<number, Channel> = ...
#chunkBuilder: undefined | McapChunkBuilder
#chunkIndices: undefined | ChunkIndex[]
#chunkSize: number
#compressChunk: undefined | ((chunkData) => {
    compressedData: Uint8Array;
    compression: string;
})

Type declaration

    • (chunkData): {
          compressedData: Uint8Array;
          compression: string;
      }
    • Parameters

      • chunkData: Uint8Array

      Returns {
          compressedData: Uint8Array;
          compression: string;
      }

      • compressedData: Uint8Array
      • compression: string
#dataSectionCrc: undefined | number

undefined means the CRC is not calculated, e.g. when using InitializeForAppending if the original file did not have a dataSectionCrc.

#metadataIndices: undefined | MetadataIndex[]
#nextChannelId: number = 0
#nextSchemaId: number = 1
#recordWriter: McapRecordBuilder = ...
#repeatChannels: boolean
#repeatSchemas: boolean
#schemas: Map<number, Schema> = ...
#useSummaryOffsets: boolean
#writable: IWritable
#writtenChannelIds: Set<number> = ...
#writtenSchemaIds: Set<number> = ...
statistics: undefined | Statistics

Methods

  • Add a channel and return a generated channel id. The channel id is used when adding messages.

    Parameters

    Returns Promise<number>

  • Add a schema and return a generated schema id. The schema id is used when adding channels.

    Parameters

    Returns Promise<number>

  • Initializes a new McapWriter for appending to an existing MCAP file. The same readWrite will be used to load indexes out of the existing file, remove the DataEnd and subsequent records, and then rewrite them when the writer is closed. The existing file must be indexed, since existing indexes, channel and schema IDs, etc. are reused when appending to the file.

    A writer initialized with this method is already "opened" and does not require a start() call, however it does require an eventual call to end() to produce a properly indexed MCAP file.

    Parameters

    Returns Promise<McapWriter>

Generated using TypeDoc