Options
All
  • Public
  • Public/Protected
  • All
Menu

A Resource containing raw buffer data

Hierarchy

Index

Constructors

constructor

  • new RawResource(rawData: Buffer, filetype: string): RawResource

Properties

data

data: string | Buffer

filetype

filetype: string

Methods

base64

  • base64(): string
  • Base64 representation of the raw data in RawResource.data

    Returns string

    base64 representation of the raw data in RawResource.data

mimetype

  • mimetype(): string

secondaryFileDict

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

    Returns { file_content: string; file_source: string; mime_type: string }

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

    • file_content: string
    • file_source: string
    • mime_type: string

templateDict

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

    Returns { file: string; template_type: string }

    dict representation of this resource as a template

    • file: string
    • template_type: 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