# new BlobStoreCustom (storeConfig: Object, appInstance: ServerApp, sessionInstance: UBSession, optionsopt: object)
Members
# accessAudit : boolean instance
Enable access audit for external requests for this BLOB store class
# App : ServerApp instance
# blacklistExtensionsSet : Set.<string> instance
Set of prohibited extensions (Example: '.jpg', '.png')
# checkForMaliciousPDF : boolean instance
Enable validation what uploaded PDF files do not contain JavaScript code
# config instance
Store parameters as defined in ubConfig
# historyDepth : number instance
How many previous revision is stored
# name instance
Name of store (from app config)
# Session : UBSession instance
# tempFolder : string instance
Path to temp folder
# whileListExtensionSet : Set.<string> instance
Set of allowed extensions (Example: '.jpg', '.png'). If null - any extension is allowed.
Methods
# validateFileName (fn: string) static
validate file name contains only alphanumeric characters, -, _, . and space and not contains ..
Arguments:
fn
: string
# doArchive (attribute: UBEntityAttribute, ID: number, blobInfo: BlobStoreItem) → BlobStoreItem instance
Do something with BLOB content during archiving. For example - move to slow drive etc. Default implementation do nothing.
Arguments:
attribute
: UBEntityAttributeID
: numberblobInfo
: BlobStoreItem
# doDeletion (attribute: UBEntityAttribute, ID: number, blobInfo: BlobStoreItem) instance
Delete persisted BLOB content
Arguments:
attribute
: UBEntityAttributeID
: numberblobInfo
: BlobStoreItem
# extensionAllowed (ext: string) → boolean instance
Check file extension allowed by store whileList and not prohibited dy store blackList
Arguments:
ext
: string
# fillResponse (requestParams: BlobStoreRequest, blobInfo: BlobStoreItem, req: THTTPRequest, resp: THTTPResponse, preventChangeRespOnErroropt: boolean) → boolean instance
Fill HTTP response for getDocument request. Sets resp to 404 status if content not found.
Arguments:
requestParams
: BlobStoreRequestblobInfo
: BlobStoreItemreq
: THTTPRequestresp
: THTTPResponsepreventChangeRespOnError
= false: booleanIf
true
- prevents sets resp status code - just returns false on error
# getContent (request: BlobStoreRequest, blobInfo: BlobStoreItem, optionsopt: object) → string | UBMail.TubSendMailAttachKind.Buffer | ArrayBuffer | null instance
Retrieve BLOB content from blob store.
Arguments:
request
: BlobStoreRequestblobInfo
: BlobStoreItemJSON retrieved from a DB
options
: object
# getContentFilePath (request: BlobStoreRequest, blobInfo: BlobStoreItem) → string instance
Returns full path to the file with BLOB content
Arguments:
request
: BlobStoreRequestblobInfo
: BlobStoreItemJSON retrieved from a DB
# getMimeType (fileNameOrExt: string, isExtensionopt: boolean) → string instance
Get mime type for passed file name or file extension. Recognize well known extensions missed in mime-db@1.52
# getTempFileName (request: BlobStoreRequest) → string instance
Get path to temporary file and it's name
Arguments:
request
: BlobStoreRequest
# persist (attribute: UBEntityAttribute, ID: number, dirtyItem: BlobStoreItem, newRevision: number) → BlobStoreItem | null instance
Move content defined by dirtyItem
from temporary to permanent store.
Return a new attribute content which describe a place of BLOB in permanent store
Arguments:
attribute
: UBEntityAttributeID
: numberdirtyItem
: BlobStoreItemnewRevision
: number
# saveContentToTempStore (request: BlobStoreRequest, attribute: UBEntityAttribute, content: ArrayBuffer | THTTPRequest, optionsopt: object) → BlobStoreItem instance
Save file content to temporary store with chunked upload support
Arguments:
request
: BlobStoreRequestRequest params
attribute
: UBEntityAttributecontent
: ArrayBuffer| THTTPRequestoptions
: objectcontentIsFilePath
: boolean