UNPKG

@directus/api

Version:

Directus is a real-time API and App dashboard for managing SQL database content

30 lines (29 loc) 1.24 kB
import type { AbstractServiceOptions, BusboyFileStream, File, MutationOptions, PrimaryKey, Query, QueryOptions } from '@directus/types'; import type { Readable } from 'node:stream'; import { ItemsService } from './items.js'; export declare class FilesService extends ItemsService<File> { constructor(options: AbstractServiceOptions); /** * Upload a single new file to the configured storage adapter */ uploadOne(stream: BusboyFileStream | Readable, data: Partial<File> & { storage: string; }, primaryKey?: PrimaryKey, opts?: MutationOptions): Promise<PrimaryKey>; /** * Extract metadata from a buffer's content */ /** * Import a single file from an external URL */ importOne(importURL: string, body: Partial<File>): Promise<PrimaryKey>; /** * Create a file (only applicable when it is not a multipart/data POST request) * Useful for associating metadata with existing file in storage */ createOne(data: Partial<File>, opts?: MutationOptions): Promise<PrimaryKey>; /** * Delete multiple files */ deleteMany(keys: PrimaryKey[]): Promise<PrimaryKey[]>; readByQuery(query: Query, opts?: QueryOptions | undefined): Promise<File[]>; }