1.3.0 ā€¢ Published 2 years ago

strapi-provider-upload-local-extra v1.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

NPM version Strapi CI status CodeQL Downloads

strapi-provider-upload-local-extra

This Strapi upload provider has extra options to customize how uploads should be stored on the local file system.

Precondition

This provider plugin requires a strapi version >4.0.0

Installation

npm install strapi-provider-upload-local-extra

Configuration

Strapi

This provider plugin needs to be configured in this file: ./config/plugins.js.

For example:

module.exports = ({ env }) => ({
    upload: {
        config: {
            provider: 'strapi-provider-upload-local-extra',
            providerOptions: /** @type {UploadLocalExtraOptions} */({
                /**
                 * @param {LocalProperties} props
                 * @returns string
                 */
                getLocalPath: props => `uploads/${props.hash}${props.ext}`
            })
        }
    }
});

šŸ’” The JsDoc type annotation @type {...} is optional, when used editors can provide code completion for an easy configuration.

UploadLocalExtraOptions

PropertyTypeDescription
sizeLimitnumberDoes not write the file to disk, when the file is too large. Throws a PayloadTooLargeError.Default: 1000000
getLocalPathLocalProperties => stringThe public directory to store the files.Default: Uses the strapi public directory.

LocalProperties

PropertyTypeDescription
fileStrapiFileThe original Strapi file object passed to the update and delete function.
hashstringThe file hash. Same as props.file.hash.
extstringThe file extendsion. Same as props.file.ext.
uniqueIdstringA unique id with 16 characters (0-9, A-Z, a-z) using nanoid
sizeNamestringThe image size as name of ('thumbnail', 'small', 'medium', 'large')

Links

1.3.0

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago