Home Reference Source
import WARCRecord from 'node-warc/lib/warcRecord/record.js'
public class | source

WARCRecord

WARC record class. The WARC named fields are properties on this object

Constructor Summary

Public Constructor
public

constructor(warcParts: {header: Buffer[], c1: Buffer[], c2: Buffer[]})

Create a new WARCRecord

Member Summary

Public Members
public

The content of the record.

public

An object containing the parsed request or response records HTTP information

public get
public get
public get
public get
public get
public get
public

An object containing the parsed WARC header

public get
public get
public get
public get
public get
public get
public get
public get
public get
public get
public get
public get
public get
public get
public get

Method Summary

Public Methods
public

getWARCHeader(headerKey: string): string

Retrieve the value of this records header field.

public

Determine if this warc record header has the supplied WARC named field.

Public Constructors

public constructor(warcParts: {header: Buffer[], c1: Buffer[], c2: Buffer[]}) source

Create a new WARCRecord

Params:

NameTypeAttributeDescription
warcParts {header: Buffer[], c1: Buffer[], c2: Buffer[]}

The parts of a warc record

Public Members

public content: Buffer source

The content of the record.

public httpInfo: RequestHTTP | ?ResponseHTTP source

An object containing the parsed request or response records HTTP information

public get warcBlockDigest: string: * source

Return:

string (nullable: true)

public get warcConcurrentTo: string: * source

Return:

string (nullable: true)

public get warcContentLength: string: * source

Return:

string (nullable: true)

public get warcContentType: string: * source

Return:

string (nullable: true)

public get warcDate: string: * source

Return:

string (nullable: true)

public get warcFilename: string: * source

Return:

string (nullable: true)

public warcHeader: Object source

An object containing the parsed WARC header

public get warcIPAddress: string: * source

Return:

string (nullable: true)

public get warcIdentifiedPayloadType: string: * source

Return:

string (nullable: true)

public get warcPayloadDigest: string: * source

Return:

string (nullable: true)

public get warcProfile: string: * source

Return:

string (nullable: true)

public get warcRecordID: string: * source

Return:

string (nullable: true)

public get warcRefersTo: string: * source

Return:

string (nullable: true)

public get warcRefersToDate: string: * source

Return:

string (nullable: true)

public get warcRefersToTargetURI: string: * source

Return:

string (nullable: true)

public get warcSegmentNumber: string: * source

Return:

string (nullable: true)

public get warcSegmentOriginID: string: * source

Return:

string (nullable: true)

public get warcSegmentTotalLength: string: * source

Return:

string (nullable: true)

public get warcTargetURI: string: * source

Return:

string (nullable: true)

public get warcTruncated: string: * source

Return:

string (nullable: true)

public get warcType: string: * source

Return:

string (nullable: true)

public get warcWarcinfoID: string: * source

Return:

string (nullable: true)

Public Methods

public getWARCHeader(headerKey: string): string source

Retrieve the value of this records header field. If the supplied header key does not start with WARC then this it will be added.

Params:

NameTypeAttributeDescription
headerKey string
  • nullable: false

The WARC header key (named field)

Return:

string (nullable: true)

Example:

 // both ways are equivalent to retrieve WARC-Type field
 record.getWARCHeader('WARC-Type')
 record.getWARCHeader('Type')

public hasWARCHeader(headerKey: string): boolean source

Determine if this warc record header has the supplied WARC named field. If the supplied header key does not start with WARC then this it will be added.

Params:

NameTypeAttributeDescription
headerKey string
  • nullable: false

The WARC header key (named field)

Return:

boolean

Example:

 // both ways are equivalent to determine if the record has the WARC-Type field
 record.hasWARCHeader('WARC-Type')
 record.hasWARCHeader('Type')