///
///
///
///
import type { MultipartFileContract } from '@ioc:Adonis/Core/BodyParser';
import type { DriveManagerContract, ContentHeaders } from '@ioc:Adonis/Core/Drive';
import type { AttachmentOptions, AttachmentContract, AttachmentAttributes } from '@ioc:Gotedo/Adonis/AttachmentLite';
/**
* Attachment class represents an attachment data type
* for Lucid models
*/
export declare class Attachment implements AttachmentContract {
private attributes;
private file?;
private buffer?;
private static drive;
/**
* Refrence to the drive
*/
static getDrive(): DriveManagerContract;
/**
* Set the drive instance
*/
static setDrive(drive: DriveManagerContract): void;
/**
* Create attachment instance from the bodyparser
* file
*/
static fromFile(file: MultipartFileContract): Attachment;
/**
* Create attachment instance from the bodyparser via a buffer
*/
static fromBuffer(buffer: Buffer, filename: string, fileType?: {
mimeType: string;
ext: string;
}): Attachment;
/**
* Create attachment instance from the database response
*/
static fromDbResponse(response: any): Attachment | null;
/**
* Attachment options
*/
private options?;
/**
* The name is available only when "isPersisted" is true.
*/
name?: string;
/**
* The clientName is available only when "isPersisted" is false.
*/
clientName?: string;
/**
* The url is available only when "isPersisted" is true.
*/
url: string;
/**
* The file size in bytes
*/
size: number;
/**
* The file extname. Inferred from the bodyparser file extname
* property
*/
extname: string;
/**
* The file mimetype.
*/
mimeType: string;
/**
* "isLocal = true" means the instance is created locally
* using the bodyparser file object
*/
isLocal: boolean;
/**
* Find if the file has been persisted or not.
*/
isPersisted: boolean;
/**
* Find if the file has been deleted or not
*/
isDeleted: boolean;
constructor(attributes: AttachmentAttributes, file?: MultipartFileContract | undefined, buffer?: Buffer | undefined);
/**
* Generates the name for the attachment and prefixes
* the folder (if defined)
*/
private generateName;
/**
* Returns disk instance
*/
private getDisk;
/**
* Define persistance options
*/
setOptions(options?: AttachmentOptions): this;
/**
* Save file to the disk. Results if noop when "this.isLocal = false"
*/
save(): Promise;
/**
* Delete the file from the disk
*/
delete(): Promise;
/**
* Computes the URL for the attachment
*/
computeUrl(): Promise;
/**
* Returns the URL for the file. Same as "Drive.getUrl()"
*/
getUrl(): Promise;
/**
* Returns the signed URL for the file. Same as "Drive.getSignedUrl()"
*/
getSignedUrl(options?: ContentHeaders & {
expiresIn?: string | number;
}): Promise;
/**
* Convert attachment to plain object to be persisted inside
* the database
*/
toObject(): AttachmentAttributes;
/**
* Convert attachment to JSON object to be sent over
* the wire
*/
toJSON(): AttachmentAttributes & {
url?: string;
};
}