TarEntry

View Source

Summary

An entry in a tar archive.

Signature

class TarEntry {
  constructor(
    header: TarHeader,
    body: ReadableStream<Uint8Array<ArrayBufferLike>>,
  ): TarEntry;

  // Accessors
  get body(): ReadableStream<Uint8Array<ArrayBufferLike>>;
  get bodyUsed(): boolean;
  get header(): TarHeader;
  get name(): string;
  get size(): number;

  // Methods
  arrayBuffer(): Promise<ArrayBuffer>;
  bytes(): Promise<Uint8Array<ArrayBufferLike>>;
  text(): Promise<string>;
}

Constructor Params

header

The header info for this entry

body

The entry's content as a stream

Accessors

body

The content of this entry as a ReadableStream<Uint8Array>.

bodyUsed

Whether the body of this entry has been consumed.

header

The raw header info associated with this entry.

name

The name of this entry.

size

The size of this entry in bytes.

Methods

arrayBuffer(): Promise

The content of this entry as an ArrayBuffer.

bytes(): Promise<Uint8Array>

The content of this entry buffered into a single typed array.

text(): Promise

The content of this entry as a string.

Note: Do not use this for binary data, use await entry.bytes() or stream entry.body directly instead.