Skip to main content
Version: 2.0.0-alpha

Interface: StorageConfig

Additional configuration related to Storage related fields

Properties

acceptedFiles

Optional acceptedFiles: string[]

File MIME types that can be uploaded to this reference. Don't specify for all

Defined in

lib/src/models/properties.ts:672


fileName

Optional fileName: string | (context: UploadedFileContext) => string

You can use this prop to customize the uploaded filename. You can use a function as a callback or a string where you specify some placeholders that get replaced with the corresponding values.

  • {file} - Full file name
  • {file.name} - Name of the file without extension
  • {file.ext} - Extension of the file
  • {rand} - Random value used to avoid name collisions
  • {entityId} - ID of the entity
  • {propertyKey} - ID of this property
  • {path} - Path of this entity

param

Defined in

lib/src/models/properties.ts:695


maxSize

Optional maxSize: number

Define maximal file size in bytes

Defined in

lib/src/models/properties.ts:727


metadata

Optional metadata: Record<string, unknown>

Specific metadata set in your uploaded file. For the default Firebase implementation, the values passed here are of type firebase.storage.UploadMetadata

Defined in

lib/src/models/properties.ts:679


storagePath

storagePath: string | (context: UploadedFileContext) => string

Absolute path in your bucket.

You can use a function as a callback or a string where you specify some placeholders that get replaced with the corresponding values.

  • {file} - Full file name
  • {file.name} - Name of the file without extension
  • {file.ext} - Extension of the file
  • {rand} - Random value used to avoid name collisions
  • {entityId} - ID of the entity
  • {propertyKey} - ID of this property
  • {path} - Path of this entity

Defined in

lib/src/models/properties.ts:710


storeUrl

Optional storeUrl: boolean

When set to true, this flag indicates that the download URL of the file will be saved in the datasource, instead of the storage path.

Note that the generated URL may use a token that, if disabled, may make the URL unusable and lose the original reference to Cloud Storage, so it is not encouraged to use this flag.

Defaults to false.

Defined in

lib/src/models/properties.ts:722

Methods

postProcess

Optional postProcess(pathOrUrl): Promise<string>

Postprocess the saved value (storage path or URL) after it has been resolved.

Parameters

NameType
pathOrUrlstring

Returns

Promise<string>

Defined in

lib/src/models/properties.ts:733