Options
All
  • Public
  • Public/Protected
  • All
Menu

The cache instance to manage cache for a source

Hierarchy

  • Cache

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Cache(dir: string): Cache

Properties

Private basePath

basePath: string

The base directory of the cache

timeout

timeout: number

The timeout for deleting cache after inactivity

Accessors

path

  • get path(): string

Methods

create

  • create(identifier: string, resource: Resource): Encoder
  • Create a new cache

    Parameters

    • identifier: string

      The audio identifier

    • resource: Resource

      The audio resource

    Returns Encoder

    The OpusEncoder stream to compress and write cache

getReader

getResource

  • getResource(identifier: string): Resource
  • Get the audio resource from an existing cache

    Parameters

    • identifier: string

      The audio identifier

    Returns Resource

    The audio resource

hasCache

  • hasCache(identifier: string): boolean
  • Check if cache exist

    Parameters

    • identifier: string

      The audio identifier

    Returns boolean

    true if exist, otherwise false

read

  • read(identifier: string, startOnSeconds?: number): Decoder
  • Read an existing cache

    Parameters

    • identifier: string

      The audio identifier

    • startOnSeconds: number = 0

      Start reading cache on specific second of audio

    Returns Decoder

    The OpusDecoder stream of audio

setOptions

Generated using TypeDoc