UNPKG

tspace-nfs

Version:

tspace-nfs is a Network File System (NFS) and provides both server and client capabilities for accessing files over a network.

120 lines (119 loc) 4.4 kB
import { Spear, Router, TContext, TNextFunction } from 'tspace-spear'; import { Queue } from './server.queue'; import { Utils } from '../utils'; import type { TCredentials } from '../types'; declare class NfsServerCore { protected _buckets: Function | null; protected _credentials: ({ token, secret, bucket }: TCredentials) => Promise<boolean> | null; protected _queue: Queue; protected _app: Spear; protected _router: Router; protected _html: string | null; protected _fileExpired: number; protected _rootFolder: string; protected _jwtExipred: number; protected _jwtSecret: string; protected _cluster: boolean | number; protected _progress: boolean; protected _debug: boolean; protected _trash: string; protected _metadata: string; protected _utils: Utils; get instance(): Spear; /** * The 'progress' is method used to view the progress of the file upload. * * @returns {this} */ debug(): this; /** * The 'progress' is method used to view the progress of the file upload. * * @returns {this} */ progress(): this; /** * The 'defaultPage' is method used to set default home page. * * @param {string} html * @returns {this} */ defaultPage(html: string): this; /** * The 'directory' is method used to set directory for root directory * * @param {string} folder * @returns {this} */ directory(folder: string): this; /** * The 'cluster' is method used to make cluster for server * * @param {number} workers * @returns {this} */ cluster(workers?: number): this; /** * The 'fileExpired' is method used to set file expiration * * @param {number} seconds * @returns {this} */ fileExpired(seconds: number): this; /** * The 'credentials' is method used to set expiration and secret for credentials * * @param {object} credentials * @property {number} credentials.expired by seconds * @property {string?} credentials.secret * @returns {this} */ credentials({ expired, secret }: { expired: number; secret?: string; }): this; /** * The 'bucketLists' method is used to inform the server about the available bucket lists. * * @param {function} callback * @returns {this} */ bucketLists(callback: () => Promise<string[]>): this; /** * The 'onBucketLists' method is used to inform the server about the available bucket lists. * * @param {function} callback * @returns {this} */ onLoadBucketLists(callback: () => Promise<string[]>): this; /** * The 'onCredentials' is method used to wrapper to check the credentials. * * @param {function} callback * @returns {this} */ onCredentials(callback: ({ token, secret, bucket }: { token: string; secret: string; bucket: string; }) => Promise<boolean>): this; protected _default: ({ res }: TContext) => Promise<any>; protected _benchmark: () => string; protected _media: ({ req, res, query, params }: TContext) => Promise<import("tspace-spear").TResponse<any>>; protected _apiFile: ({ req, res, body }: TContext) => Promise<void>; protected _apiBase64: ({ req, res, body }: TContext) => Promise<void>; protected _apiStream: ({ req, res, body }: TContext) => Promise<void | import("tspace-spear").TResponse<any>>; protected _apiStorage: ({ req, res, body }: TContext) => Promise<void>; protected _apiFolders: ({ req, res }: TContext) => Promise<void>; protected _apiUpload: ({ req, res, files, body }: TContext) => Promise<void>; protected _apiMerge: ({ req, res, body }: TContext) => Promise<void>; protected _apiUploadBase64: ({ req, res, body }: TContext) => Promise<void>; protected _apiRemove: ({ req, res, body }: TContext) => Promise<void>; protected _apiConnect: ({ res, body }: TContext) => Promise<void>; protected _apiHealthCheck: ({ res, headers }: TContext) => Promise<void>; protected _authMiddleware: ({ req, res, headers }: TContext, next: TNextFunction) => any; protected _authStudioMiddleware: ({ req, res, cookies }: TContext, next: TNextFunction) => any; private _verify; } export { NfsServerCore }; export default NfsServerCore;