Options
All
  • Public
  • Public/Protected
  • All
Menu

The abstract base class for the resources

Hierarchy

Index

Constructors

constructor

  • new Resource(data: string | Buffer, filetype: string): Resource
  • Parameters

    • data: string | Buffer

      the data for this resource

    • filetype: string

      the filetype of this resource

    Returns Resource

Properties

data

data: string | Buffer

filetype

filetype: string

Methods

mimetype

  • mimetype(): string
  • Resource type as a mime type

    Returns string

    resource type as a mime type

secondaryFileDict

  • secondaryFileDict(): {}
  • This Resource object as a dict object for use as a secondary file (prepend, append, insert,as subtemplate)

    Returns {}

    this Resource object as a dict object for use as a secondary file (prepend, append, insert, as subtemplate)

    • [key: string]: string

templateDict

  • templateDict(): {}
  • This Resource object as a dict object for use as a template

    Returns {}

    dict representation of this resource as a template

    • [key: string]: string

Static fromBase64

  • Create a Base64Resource from a base64 string and a file type (extension)

    Parameters

    • base64string: string

      base64 encoded representation of a file

    • filetype: string

      file type (extension)

    Returns Base64Resource

    the created Resource

Static fromHtml

  • fromHtml(htmlstring: string, landscape?: boolean): HTMLResource
  • Create an HTMLResource with html data in plain text. Landscape is not supported for prepend/append sources, only for template resources.

    Parameters

    • htmlstring: string

      html content

    • landscape: boolean = false

      Whether or not the orientation needs to be landscape. Defaults to false.

    Returns HTMLResource

    the created Resource

Static fromLocalFile

  • Create a Base64Resource with the contents of a local file. The filetype is determined by the extension of the file.

    Parameters

    • localPath: string

      path to local file

    Returns Base64Resource

    the created Resource

Static fromRaw

  • fromRaw(rawData: Buffer, filetype: string): RawResource
  • Create a RawResource from raw file data and a file type (extension)

    Parameters

    • rawData: Buffer

      raw data as a Buffer object

    • filetype: string

      file type (extension)

    Returns RawResource

    the created Resource

Static fromServerPath

  • Create a ServerPathResource targeting a file on the server. The filetype is determined by the extension of the file.

    Parameters

    • serverPath: string

      location of target file on the server

    Returns ServerPathResource

    the created Resource

Static fromUrl

  • Create a URLResource targeting the file at url with given filetype (extension).

    Parameters

    • url: string

      file url

    • filetype: string

      file type (extension)

    Returns URLResource

    the created Resource

Generated using TypeDoc