Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Binary<T>

This is an abstract service to represent a storage of files The binary allow you to expose this service as HTTP ( therefore is an executor ) It needs an object to attach the binary too

The Binary storage should store only once a binary and reference every object that are used by this binary, so it can be cleaned.

see

FileBinary

see

S3Binary

exports
abstract

Type parameters

Hierarchy

Constructors

  • new Binary(webda: Core, name: string, params?: any): Binary

Properties

_createException: string
_initException: any = undefined
_initTime: number
_lowercaseMaps: any
_name: string

Service name

_webda: Core

Webda Core object

logger: Logger

Logger with class context

parameters: T

Hold the parameters for your service

It will be bring from the webda.config.json

defaultMaxListeners: number

Methods

  • __clean(): Promise<any>
  • _checkMap(name: any, property: any): void
  • _get(info: any): ReadableStream
  • _getFile(req: any): any
  • _getHashes(buffer: any): any
  • _getUrl(info: any, ctx: Context): void
  • _initRoutes(): boolean
  • _prepareInput(file: any): void
  • _validChallenge(challenge: any): boolean
  • addListener(event: string | symbol, listener: function): this
  • addRoute(url: string, methods: HttpMethodType[], executer: Function, openapi?: object, allowPath?: boolean): void
  • cascadeDelete(info: any, uuid: any): void
  • challenge(hash: any, challenge: any): boolean
  • computeParameters(): void
  • delete(targetStore: any, object: any, property: any, index: any): Promise<CoreModel>
  • Update a binary

    emits

    'binaryDelete'

    Parameters

    • targetStore: any

      The store that handles the object to attach binary to

    • object: any

      The object uuid to get from the store

    • property: any

      The object property to add the file to

    • index: any

      The index of the file to change in the property

    Returns Promise<CoreModel>

  • deleteSuccess(targetStore: any, object: any, property: any, index: any): any
  • downloadTo(info: any, filename: any): Promise<void>
  • emit(event: string | symbol, ...args: any[]): boolean
  • emitSync(event: any, data: any): Promise<any[]>
  • eventNames(): Array<string | symbol>
  • get(info: any): Promise<ReadableStream<any>>
  • getMaxListeners(): number
  • getName(): string
  • getParameters(): T
  • getService<T>(service: string): T
  • getUsageCount(hash: any): Promise<number>
  • httpChallenge(ctx: Context): Promise<void>
  • httpPost(ctx: Context): Promise<void>
  • httpRoute(ctx: Context): Promise<void>
  • initMap(map: any): void
  • initRoutes(): void
  • listenerCount(type: string | symbol): number
  • listeners(event: string | symbol): Function[]
  • off(event: string | symbol, listener: function): this
  • on(event: string | symbol, listener: function): this
  • onAsync(event: any, callback: any, queue?: string): void
  • Listen to an event as on(...) would do except that it will be asynchronous

    Parameters

    • event: any
    • callback: any
    • Default value queue: string = undefined

      Name of queue to use, can be undefined, queue name are used to define differents priorities

    Returns void

  • once(event: string | symbol, listener: function): this
  • prependListener(event: string | symbol, listener: function): this
  • prependOnceListener(event: string | symbol, listener: function): this
  • putRedirectUrl(ctx: Context): Promise<string>
  • rawListeners(event: string | symbol): Function[]
  • reinit(config: any): Promise<void>
  • removeAllListeners(event?: string | symbol): this
  • removeListener(event: string | symbol, listener: function): this
  • resolve(): void
  • setMaxListeners(n: number): this
  • store(targetStore: any, object: any, property: any, file: any, metadatas: any, index?: string): Promise<any>
  • When you store a binary to be able to retrieve it you need to store the information into another object

    If you have a User object define like this : User = {'name': 'Remi', 'uuid': 'Loopingz'} You will call the store(userStore, 'Loopingz', 'images', filedata, {'type':'profile'}) After a successful call the object will look like User = {'name': 'Remi', 'uuid': 'Loopingz', 'images': [{'type':'profile','hash':'a12545...','size':1245,'mime':'application/octet'}]}

    emits

    'binaryCreate'

    Parameters

    • targetStore: any

      The store that handles the object to attach binary to

    • object: any

      The object uuid to get from the store

    • property: any

      The object property to add the file to

    • file: any

      The file by itself

    • metadatas: any

      to add to the binary object

    • Default value index: string = "add"

    Returns Promise<any>

  • storeBinary(ctx: Context): Promise<void>
  • toPublicJSON(object: any): string
  • update(targetStore: any, object: any, property: any, index: any, file: any, metadatas: any): Promise<CoreModel>
  • Update a binary

    emits

    'binaryUpdate'

    Parameters

    • targetStore: any

      The store that handles the object to attach binary to

    • object: any

      The object uuid to get from the store

    • property: any

      The object property to add the file to

    • index: any

      The index of the file to change in the property

    • file: any

      The file by itself

    • metadatas: any

      to add to the binary object

    Returns Promise<CoreModel>

  • updateSuccess(targetStore: any, object: any, property: any, index: any, file: any, metadatas: any): Promise<any>
  • listenerCount(emitter: EventEmitter, event: string | symbol): number

Generated using TypeDoc