StorageConfig
@firecms/core / StorageConfig
Type Alias: StorageConfig
Section titled “Type Alias: StorageConfig”StorageConfig =
object
Defined in: types/properties.ts:765
Additional configuration related to Storage related fields
Properties
Section titled “Properties”acceptedFiles?
Section titled “acceptedFiles?”
optionalacceptedFiles:FileType[]
Defined in: types/properties.ts:773
File MIME types that can be uploaded to this reference. Don’t specify for
all.
Note that you can also use the asterisk notation, so image/*
accepts any image file, and so on.
fileName?
Section titled “fileName?”
optionalfileName:string| (context) =>string|Promise<string>
Defined in: types/properties.ts:802
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
imageCompression?
Section titled “imageCompression?”
optionalimageCompression:ImageCompression
Defined in: types/properties.ts:779
Use client side image compression and resizing Will only be applied to these MIME types: image/jpeg, image/png and image/webp
maxSize?
Section titled “maxSize?”
optionalmaxSize:number
Defined in: types/properties.ts:834
Define maximal file size in bytes
metadata?
Section titled “metadata?”
optionalmetadata:Record<string,unknown>
Defined in: types/properties.ts:786
Specific metadata set in your uploaded file.
For the default Firebase implementation, the values passed here are of type
firebase.storage.UploadMetadata
postProcess()?
Section titled “postProcess()?”
optionalpostProcess: (pathOrUrl) =>Promise<string>
Defined in: types/properties.ts:847
Postprocess the saved value (storage path or URL) after it has been resolved.
Parameters
Section titled “Parameters”pathOrUrl
Section titled “pathOrUrl”string
Returns
Section titled “Returns”Promise<string>
previewUrl()?
Section titled “previewUrl()?”
optionalpreviewUrl: (fileName) =>string
Defined in: types/properties.ts:853
You can use this prop in order to provide a custom preview URL. Useful when the file’s path is different from the original field value
Parameters
Section titled “Parameters”fileName
Section titled “fileName”string
Returns
Section titled “Returns”string
processFile()?
Section titled “processFile()?”
optionalprocessFile: (file) =>Promise<File> |undefined
Defined in: types/properties.ts:841
Use this callback to process the file before uploading it to the storage. If nothing is returned, the file is uploaded as it is.
Parameters
Section titled “Parameters”File
Returns
Section titled “Returns”Promise<File> | undefined
storagePath
Section titled “storagePath”storagePath:
string| (context) =>string
Defined in: types/properties.ts:817
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
storeUrl?
Section titled “storeUrl?”
optionalstoreUrl:boolean
Defined in: types/properties.ts:829
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.