BinaryFile
Abstract Class: BinaryFile<T>
Defined in: packages/core/src/services/binary.service.ts:120
Represent a file to store
Webda Schema
Extended by
Type Parameters
T
T extends object = { }
Implements
Constructors
Constructor
new BinaryFile<
T>(info):BinaryFile<T>
Defined in: packages/core/src/services/binary.service.ts:158
Create a new BinaryFile
Parameters
info
the binary file information
Returns
BinaryFile<T>
Properties
challenge?
optionalchallenge?: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
Implementation of
hash?
optionalhash?:string
Defined in: packages/core/src/services/binary.service.ts:149
Will be computed by the service
hash of the content
Implementation of
metadata?
optionalmetadata?:T
Defined in: packages/core/src/services/binary.service.ts:153
Metadatas stored along with the binary
Implementation of
mimetype
mimetype:
string
Defined in: packages/core/src/services/binary.service.ts:136
Mimetype of the binary
Implementation of
name
name:
string
Defined in: packages/core/src/services/binary.service.ts:124
Current name
Implementation of
originalname?
optionaloriginalname?:string
Defined in: packages/core/src/services/binary.service.ts:128
Original name
size
size:
number
Defined in: packages/core/src/services/binary.service.ts:132
Size of the binary
Implementation of
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
get()
abstractget():Promise<Readable>
Defined in: packages/core/src/services/binary.service.ts:191
Returns
Promise<Readable>
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
set()
set(
info):void
Defined in: packages/core/src/services/binary.service.ts:166
Set the information
Parameters
info
the information object
Returns
void
toBinaryFileInfo()
toBinaryFileInfo():
BinaryFileInfo<T>
Defined in: packages/core/src/services/binary.service.ts:179
Retrieve a plain BinaryFileInfo object
Returns
the result