Skip to content
Discussion options

You must be logged in to vote

I've recently faced a similar problem (creating a service provider for S3 file management).

  1. Run node ace make:provider ImageServiceProvider to create and register your Service Provider
  2. Create the service (i've created a seperate folder /services inside the project root). Let's call it S3Service for now with the following stub:
import { MultipartFileContract } from "@ioc:Adonis/Core/BodyParser"

export class S3Service {
    public async upload(file: MultipartFileContract): Promise<void> {
        // Upload the file to your S3 provider ...
    }

    public async download(file: string): Promise<Readable> {
        // Stream file from S3 ...
    }
}
  1. Register the S3Service class to get res…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@remidosol
Comment options

@steschwa
Comment options

@remidosol
Comment options

@steschwa
Comment options

Answer selected by remidosol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants