@jrmc/adonis-attachment
Version:
Turn any field on your Lucid model to an attachment data type
57 lines • 1.87 kB
TypeScript
/**
* @jrmc/adonis-attachment
*
* @license MIT
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
*/
import type { LucidRow } from '@adonisjs/lucid/types/model';
import type { DriveService, SignedURLOptions } from '@adonisjs/drive/types';
import type { LucidOptions, AttachmentBaseAttributes, AttachmentBase as AttachmentBaseInterface } from '../types/attachment.js';
import type { Exif, Input } from '../types/input.js';
export declare class AttachmentBase implements AttachmentBaseInterface {
#private;
drive: DriveService;
input?: Input;
size: number;
extname: string;
mimeType: string;
meta?: Exif;
originalPath?: string;
url?: string;
options: LucidOptions;
constructor(drive: DriveService, attributes: AttachmentBaseAttributes, input?: Input);
/**
* Getters / Setters
*/
get name(): string;
set name(name: string);
get folder(): string | undefined;
get path(): string;
/**
* Methods
*/
getDisk(): import("flydrive").Disk;
getBytes(): Promise<Uint8Array<ArrayBufferLike>>;
getBuffer(): Promise<Buffer<ArrayBuffer>>;
getStream(): Promise<import("stream").Readable>;
getUrl(): Promise<string>;
getSignedUrl(signedUrlOptions?: SignedURLOptions): Promise<string>;
getKeyId(): string | undefined;
setKeyId(keyId: string): this;
setOptions(options: LucidOptions): this;
/**
* Actions
*/
computeUrl(signedUrlOptions?: SignedURLOptions): Promise<void>;
preComputeUrl(): Promise<void>;
makeName(record?: LucidRow, attributeName?: string, originalName?: string): Promise<this>;
makeFolder(record?: LucidRow): Promise<this>;
put(): Promise<void>;
remove(): Promise<void>;
/**
*
*/
toObject(): AttachmentBaseAttributes;
toJSON(): Object;
}
//# sourceMappingURL=attachment_base.d.ts.map