Blob store implementation for storing content inside folder, defined in application.blobStores.path

Singleton

# new FileSystemBlobStore (storeConfig:  object, appInstance:  ServerApp, sessionInstance:  UBSession, optionsopt:  object)

Arguments:

Members

# fullStorePath instance

Normalized path to the store root

# LUCount instance

Logical Unit Count for store. If > 0 then files are stored inside Logical Unit sub-folders /LU01, /LU02 etc Write operations works with last LU folder

# newFolderMask : string instance

File system permission mask for new folders. Default is 0o750. Set it to 0 to inherit permissions. Use string value for octal representation, like "755" or "750", or use number value like 488 for 0o750.

# options : Object instance

Store options

Methods

# checkTempFileBeforePersist (attribute:  UBEntityAttribute, ID:  number, dirtyItem:  BlobStoreItem) → string instance

Validate temp file exists, return full path to temp file, null in case of dirty item deletion or throw an error

Arguments:

# doDeletion (attribute:  UBEntityAttribute, ID:  number, blobInfo:  BlobStoreItem) instance

Arguments:

# fillResponse (requestParams:  BlobStoreRequest, blobInfo:  BlobStoreItem, req:  THTTPRequest, resp:  THTTPResponse, preventChangeRespOnErroropt:  boolean) → boolean instance

Fill HTTP response for getDocument request

Arguments:

# genNewPlacement (attribute:  UBEntityAttribute, dirtyItem:  BlobStoreItem, ID:  number, optionsopt:  object) → Object instance

Calculate a relative path & file name for a new BLOB item. If new folder does not exist - create it

Arguments:

# getContent (request:  BlobStoreRequest, blobInfo:  BlobStoreItem, optionsopt:  object) → string | UBMail.TubSendMailAttachKind.Buffer | ArrayBuffer | null instance

Retrieve BLOB content from blob store.

Arguments:
  • request: BlobStoreRequest
  • blobInfo: BlobStoreItem

    JSON retrieved from a DB.

  • options: object
    • encoding:  string | null

      Possible values: 'bin' 'ascii' 'binary' 'hex' ucs2/ucs-2/utf16le/utf-16le utf8/utf-8 base64 if null will return Buffer, if bin - ArrayBuffer

# getContentFilePath (request:  BlobStoreRequest, blobInfo:  BlobStoreItem) → string instance

Returns full path to the file with BLOB content

Arguments:

# getPermanentFileName (blobItem:  BlobStoreItem, requestopt:  BlobStoreRequest) → string instance

For file based store:

  • store.path + relativePath + fileName

Return:

In case of item not exists - return empty string ''

Arguments:

# persist (attribute:  UBEntityAttribute, ID:  number, dirtyItem:  BlobStoreItem, newRevision:  number) → BlobStoreItem | null instance

Move content defined by dirtyItem from temporary to permanent store. TIPS: in v0 (UB<5) if file updated then implementation takes a store from old item. This raise a problem - old store may be in archive state (readonly) So in UB5 we change implementation to use a store defined in the attribute for new items

Return a new attribute content which describe a place of the BLOB in permanent store

Arguments: