Class GlobalQuotaStrategy

The GlobalQuotaStrategy sets a limit on the amount of data stored on the server globally.

Hierarchy

Constructors

Properties

base: string
limit: Size
reporter: SizeReporter<any>

Methods

  • Get a Passthrough stream that will keep track of the available space. If the quota is exceeded the stream will emit an error and destroy itself. Like other Passthrough instances this will simply pass on the chunks, when the quota isn't exceeded.

    Parameters

    Returns Promise<Guarded<PassThrough>>

    a Passthrough instance that errors when quota is exceeded

  • Get the available space when writing data to the given identifier. If the given resource already exists it will deduct the already taken up space by that resource since it is going to be overwritten and thus counts as available space.

    Parameters

    • identifier: ResourceIdentifier

      the identifier of the resource of which you want the available space

    Returns Promise<Size>

    the available space and the unit of the space as a Size object