Overview + installation

Before starting you need to be authenticated, since the package is hosted within a private npm registry, the authentication steps are described before.

Authentication chevron-right

The Storage Manager Package is a generic storage solution built with NestJS, designed to provide flexible and extendable storage strategies for various providers, including Local, S3, and MinIO. This package simplifies file management with features such as uploading, generating URLs, and creating pre-signed URLs.

Quick Start

  1. Import the Module:

    Use the StorageManagerModule.register method to configure the storage strategy during module registration.

import { StorageManagerModule } from 'storage-manager-package';

@Module({
    imports: [
        StorageManagerModule.register({
            useFactory: async () => ({
                provider: 'LOCAL',
                uploadDir: './uploads',
                baseUrl: 'http://localhost:3000/uploads',
            }),
        }),
    ],
})
export class AppModule {}

2. Inject the Service:

Use the StorageManagerService to interact with the storage system

Features

1. Upload Files

Upload a single file or multiple files to the storage.

Example:

2. Get File URL

Retrieve the URL of a stored file using its ID.

Example:

3. Delete Files

Delete a file by its ID.

Example:

4. Generate Pre-signed URLs

Create a pre-signed URL for file operations (e.g., read or write).

Example:

Install the package in your app:

Last updated