UNPKG

@adonisjs/drive

Version:

A thin wrapper on top of Flydrive to work seamlessly with AdonisJS

25 lines (24 loc) 950 B
import type { Router } from '@adonisjs/core/http'; import type { AdonisFSDriverOptions } from './types.ts'; import type { FSDriverOptions } from 'flydrive/drivers/fs/types'; /** * Creates the URL builder for the flydrive "fs" driver. * * @param router - The AdonisJS router instance * @param config - The FS driver configuration options * @param routeName - The name of the route for file serving * * @example * ```js * const urlBuilder = createURLBuilder(router, { * location: '/uploads', * visibility: 'public', * serveFiles: true, * routeBasePath: '/uploads' * }, 'drive.uploads.serve') * * const url = await urlBuilder.generateURL('photo.jpg') * const signedUrl = await urlBuilder.generateSignedURL('private.pdf', null, { expiresIn: '1h' }) * ``` */ export declare function createURLBuilder(router: Router, config: AdonisFSDriverOptions, routeName: string): Exclude<Required<FSDriverOptions['urlBuilder']>, undefined>;