Home Reference Source

Function

Static Public Summary
public

ensureWARCFilename(filename: string, gzipping: boolean): string

Ensure that the supplied name for the WARC is correct

public

getResBodyElectron(requestId: string, wcDebugger: Object): Promise<Buffer>

Electron requires the use of the debugger to retrieve the requests response body

public

Test to see if a plain object is empty

public

Creates async iterator that yields WARCRecords given a readable stream of a WARC file

public

Converts an HTTP headers object into its string representation

public

Converts an HTTP request headers object into its string representation

Static Public

public ensureWARCFilename(filename: string, gzipping: boolean): string source

import ensureWARCFilename from 'node-warc/lib/utils/ensureWARCFilename.js'

Ensure that the supplied name for the WARC is correct

Params:

NameTypeAttributeDescription
filename string
gzipping boolean
  • optional
  • default: false

Return:

string

public getResBodyElectron(requestId: string, wcDebugger: Object): Promise<Buffer> source

import getResBodyElectron from 'node-warc/lib/utils/getResBodyElectron.js'

Electron requires the use of the debugger to retrieve the requests response body

Params:

NameTypeAttributeDescription
requestId string

the request to fetch the response body for

wcDebugger Object

the Electron debugger to use to get the response body

Return:

Promise<Buffer>

body - the response body as a node buffer

Throw:

ElectronGetResError

rejects if the error parameter to the callback was set

See:

public isEmptyPlainObject(object: Object): boolean source

import isEmptyPlainObject from 'node-warc/lib/utils/isEmptyPlainObject.js'

Test to see if a plain object is empty

Params:

NameTypeAttributeDescription
object Object
  • nullable: true

Return:

boolean

public async * recordIterator(warcStream: ReadStream | Gunzip): AsyncIterator<WARCRecord> source

import recordIterator from 'node-warc/lib/parsers/recordterator.js'

Creates async iterator that yields WARCRecords given a readable stream of a WARC file

Params:

NameTypeAttributeDescription
warcStream ReadStream | Gunzip

public stringifyHeaders(headers: Object): string source

import {stringifyHeaders} from 'node-warc/lib/utils/headerSerializers.js'

Converts an HTTP headers object into its string representation

Params:

NameTypeAttributeDescription
headers Object

The HTTP header object to be stringified

Return:

string

public stringifyRequestHeaders(headers: Object, host: string): string source

import {stringifyRequestHeaders} from 'node-warc/lib/utils/headerSerializers.js'

Converts an HTTP request headers object into its string representation

Params:

NameTypeAttributeDescription
headers Object

The HTTP headers object for the request

host string

The host for the request to be used if the HTTP headers object does not contain the Host field

Return:

string