Amplication
Platform
Solutions
Learn
Star Us 12.7K
Log In to Amplication

Contact us

  • contact@amplication.org
Try Overcut.ai
  • Home /
  • Plugins /
  • Storage Local
plugin logo
Storage Local
Install Plugin

@amplication/plugin-storage-local

NPM Downloads

Purpose

This plugin is used for integrating local storage services into your app generated by Amplication.

Configuration

The plugin has the following configuration options:

  • fileBasePath: The base path where the files will be stored. The default value is ./uploads.
  • maxFileSize: The maximum file size in bytes. The default value is 10485760 (10MB).

Example configuration:

{
  "fileBasePath": "./uploads",
  "maxFileSize": 10485760
}

[!CAUTION] The storage-core plugin should be added through the plugins page of the app settings before adding this plugin. Else code generation will fail and throw an error.

What the plugin does

Adds service methods

It adds the following service methods for each field of type File in the entities:

  • upload: This method takes a file and uses the following name schmea to store the file: <fieldName>-<entityId>-<fileName>. ( eg: profileImage-1-image.png )

  • delete

  • download

Provides the local storage methods

  • uploadFile: This method is used to upload a file to the local storage. It takes the following parameters:

    • file: The file to be uploaded.
    • extension: The file mimeypes allowed for the file.
    • basePath: The base path where the file will be stored. If not provided, the default value from the configuration will be used.
    • maxFileSize: The maximum file size in bytes. If not provided, the default value from the configuration will be used.
  • deleteFile: This method is used to delete a file from the local storage.

  • downloadFile: This method is used to download a file from the local storage.

[!CAUTION] In case of extensions being empty, no file will be uploaded and an error will be thrown.

Scripts

build

Running npm run build will bundle your plugin with Webpack for production.

dev

Running npm run dev will watch your plugin's source code and automatically bundle it with every change.

Details
npm
@amplication/plugin-storage-local
github
https://github.com/amplication/plugins/tree/main/plugins/storage-local
Installs
0
Categories
Storage
Documentation
https://github.com/amplication/plugins/tree/main/plugins/storage-local

Get started with Amplication and Storage Local

Start NowBook a demo

Platform

Live TemplatesPluginsJovu

Solutions

Enhance platform engineeringBuild new servicesBuild APIs on existing DBModernize applications

Customers

IT ServicesRetailHealthcareManufacturingCustomer stories

Use Amplication

Get started Custom pluginsCustom codeSync with GitEvent-driven architectureBreak the monolith

Resources

DocsCustomer storiesPlugins catalogDiscord communityGitHubBlog

About

CompanyContact us

©2025 amplication

Privacy PolicyTerms & Conditions
Follow usTwitter IconYouTube Icon