Skip to main content

@webda/coreReadme | API


Class: Binary<T>

One Binary instance

Extends

Type parameters

T = any

Constructors

new Binary(attribute, model)

new Binary<T>(attribute, model): Binary<T>

Parameters

attribute: string

model: CoreModel

Returns

Binary<T>

Overrides

BinaryMap.constructor

Source

packages/core/src/services/binary.ts:306

Properties

__ctx

__ctx: OperationContext<any, any>

Current context

Inherited from

BinaryMap.__ctx

Source

packages/core/src/services/binary.ts:247


__store

__store: BinaryService<BinaryParameters, BinaryEvents>

Link to the binary store

Inherited from

BinaryMap.__store

Source

packages/core/src/services/binary.ts:252


attribute

protected attribute: string

Source

packages/core/src/services/binary.ts:303


challenge?

challenge?: string

Will be computed by the service

hash of the content prefixed by 'WEBDA'

Inherited from

BinaryMap.challenge

Source

packages/core/src/services/binary.ts:106


empty

protected empty: boolean

Source

packages/core/src/services/binary.ts:305


hash?

hash?: string

Will be computed by the service

hash of the content

Inherited from

BinaryMap.hash

Source

packages/core/src/services/binary.ts:112


metadata?

metadata?: T

Metadatas stored along with the binary

Inherited from

BinaryMap.metadata

Source

packages/core/src/services/binary.ts:116


mimetype

mimetype: string

Mimetype of the binary

Inherited from

BinaryMap.mimetype

Source

packages/core/src/services/binary.ts:100


model

protected model: CoreModel

Source

packages/core/src/services/binary.ts:301


name

name: string

Current name

Inherited from

BinaryMap.name

Source

packages/core/src/services/binary.ts:88


originalname?

originalname?: string

Original name

Inherited from

BinaryMap.originalname

Source

packages/core/src/services/binary.ts:92


size

size: number

Size of the binary

Inherited from

BinaryMap.size

Source

packages/core/src/services/binary.ts:96

Methods

delete()

delete(): Promise<void>

Delete the binary, if you need to replace just use upload

Returns

Promise<void>

Source

packages/core/src/services/binary.ts:344


downloadTo()

downloadTo(filename): Promise<void>

Download the binary to a path

Shortcut to call Binary.downloadTo with current object

Parameters

filename: string

Returns

Promise<void>

Inherited from

BinaryMap.downloadTo

Source

packages/core/src/services/binary.ts:283


get()

get(): Promise<Readable>

Get the binary data

Returns

Promise<Readable>

Inherited from

BinaryMap.get

Source

packages/core/src/services/binary.ts:265


getAsBuffer()

getAsBuffer(): Promise<Buffer>

Get into a buffer

Returns

Promise<Buffer>

Inherited from

BinaryMap.getAsBuffer

Source

packages/core/src/services/binary.ts:272


getHashes()

getHashes(): Promise<Object>

Create hashes

Returns

Promise<Object>

challenge

challenge: string

hash

hash: string

Inherited from

BinaryMap.getHashes

Source

packages/core/src/services/binary.ts:157


isEmpty()

isEmpty(): boolean

isEmpty

Returns

boolean

Source

packages/core/src/services/binary.ts:317


set()

set(info): void

Ensure empty is set correctly

Parameters

info: BinaryFileInfo

Returns

void

Overrides

BinaryMap.set

Source

packages/core/src/services/binary.ts:325


setContext()

setContext(ctx): void

Set the http context

Parameters

ctx: OperationContext<any, any>

Returns

void

Inherited from

BinaryMap.setContext

Source

packages/core/src/services/binary.ts:291


toBinaryFileInfo()

toBinaryFileInfo(): BinaryFileInfo

Retrieve a plain BinaryFileInfo object

Returns

BinaryFileInfo

Inherited from

BinaryMap.toBinaryFileInfo

Source

packages/core/src/services/binary.ts:138


toJSON()

toJSON(): Binary<T>

Return undefined if no hash

Returns

Binary<T>

Source

packages/core/src/services/binary.ts:353


upload()

upload(file): Promise<void>

Replace the binary

Parameters

file: BinaryFile<any>

Returns

Promise<void>

Source

packages/core/src/services/binary.ts:336