Function ProvideFile

  • Decorator that marks a method as a file provider. The method will be called when a request is made to retrieve a file.

    Supported Decorators:

    • @Auth

    Parameters

    • accessor: string

      The accessor for the file provider.

    Returns ((target, propertyKey) => void)

      • (target, propertyKey): void
      • Parameters

        • target: any
        • propertyKey: string

        Returns void

    Example

    The following code initializes the file provider. When running a GET request to '/file/example[/id[/auth]]', this method is called. Supports authenticators like websocket decorators do.

    @ProvideFile("example")
    @Auth(new Authenticator(4)) // optional
    async provideFile(id: string, auth: string) {
    return new ProvidedFile(
    +id,
    "Example",
    content,
    contentType
    );
    }

Generated using TypeDoc