Skip to main content

MemoryBinaryFile

@webda/core


Class: MemoryBinaryFile

Defined in: packages/core/src/services/binary.service.ts:261

BinaryFile backed by an in-memory Buffer

Extends​

Constructors​

Constructor​

new MemoryBinaryFile(buffer, info?): MemoryBinaryFile

Defined in: packages/core/src/services/binary.service.ts:272

Create a new MemoryBinaryFile

Parameters​

buffer​

string | Buffer<ArrayBufferLike>

the binary content

info?​

Partial<BinaryFileInfo> = {}

optional file information

Returns​

MemoryBinaryFile

Overrides​

BinaryFile.constructor

Properties​

buffer​

buffer: Buffer

Defined in: packages/core/src/services/binary.service.ts:266

Content


challenge?​

optional challenge?: string

Defined in: packages/core/src/services/binary.service.ts:143

Proof of possession of the content: hash of the content prefixed by 'WEBDA', computed by the client of the challenge and by the service on upload. Never persisted on a model nor sent to clients: it is not part of the schema of a binary attribute

Schema Ignore​

Inherited from​

BinaryFile.challenge


hash?​

optional hash?: string

Defined in: packages/core/src/services/binary.service.ts:149

Will be computed by the service

hash of the content

Inherited from​

BinaryFile.hash


metadata?​

optional metadata?: object

Defined in: packages/core/src/services/binary.service.ts:153

Metadatas stored along with the binary

Inherited from​

BinaryFile.metadata


mimetype​

mimetype: string

Defined in: packages/core/src/services/binary.service.ts:136

Mimetype of the binary

Inherited from​

BinaryFile.mimetype


name​

name: string

Defined in: packages/core/src/services/binary.service.ts:124

Current name

Inherited from​

BinaryFile.name


originalname?​

optional originalname?: string

Defined in: packages/core/src/services/binary.service.ts:128

Original name

Inherited from​

BinaryFile.originalname


size​

size: number

Defined in: packages/core/src/services/binary.service.ts:132

Size of the binary

Inherited from​

BinaryFile.size

Methods​

computeHashes()​

computeHashes(): Promise<{ challenge: string; hash: string; }>

Defined in: packages/core/src/services/binary.service.ts:199

Compute the hashes from the content, whatever hash or challenge is already set

The hash is the md5 of the bytes, the challenge the md5 of "WEBDA" followed by the bytes

Returns​

Promise<{ challenge: string; hash: string; }>

the computed hash and challenge

Inherited from​

BinaryFile.computeHashes


get()​

get(): Promise<Readable>

Defined in: packages/core/src/services/binary.service.ts:285

Returns​

Promise<Readable>

Overrides​

BinaryFile.get


getHashes()​

getHashes(): Promise<{ challenge: string; hash: string; }>

Defined in: packages/core/src/services/binary.service.ts:220

Create hashes, computed from the content unless a hash is already set

Returns​

Promise<{ challenge: string; hash: string; }>

the result

Inherited from​

BinaryFile.getHashes


set()​

set(info): void

Defined in: packages/core/src/services/binary.service.ts:166

Set the information

Parameters​

info​

BinaryFileInfo<{ }>

the information object

Returns​

void

Inherited from​

BinaryFile.set


toBinaryFileInfo()​

toBinaryFileInfo(): BinaryFileInfo<{ }>

Defined in: packages/core/src/services/binary.service.ts:179

Retrieve a plain BinaryFileInfo object

Returns​

BinaryFileInfo<{ }>

the result

Inherited from​

BinaryFile.toBinaryFileInfo