UNPKG

@nocobase/plugin-file-manager

Version:

Provides files storage services with files collection template and attachment field.

43 lines (42 loc) 1.63 kB
/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ /// <reference types="node" /> import multer from 'multer'; import type { Readable } from 'stream'; import { AttachmentModel, StorageType } from '.'; export declare function normalizeLocalStoragePath(storagePath?: unknown): string; export declare function getDocumentRoot(storage: any): string; export declare function resolveSafePath(documentRoot: string, filePath?: string, filename?: string): string; export declare function validateLocalStorageConfig(storage: Pick<StorageType['storage'], 'type' | 'options' | 'path'>, { validateDocumentRoot }?: { validateDocumentRoot?: boolean; }): void; export default class extends StorageType { static defaults(): { title: string; type: string; name: string; baseUrl: string; options: { documentRoot: string; }; path: string; rules: { size: number; }; }; make(): multer.StorageEngine; exists(record: AttachmentModel): Promise<boolean>; copy(source: AttachmentModel, target: AttachmentModel): Promise<void>; delete(records: AttachmentModel[]): Promise<[number, AttachmentModel[]]>; getFileURL(file: AttachmentModel, preview?: boolean): Promise<any>; getFileStream(file: AttachmentModel): Promise<{ stream: Readable; contentType?: string; }>; }