///
///
///
import { Service } from "../service";
import * as mongodb from "mongodb";
import * as Leaf from "leaf-ts";
import { MongodbService } from "./mongodbService";
import { ExpressService } from "./expressService";
import { IncrementalIdService } from "./incrementalIdService";
export declare type Callback = (e?: E, result?: T) => void;
export declare const Errors: {
HashError: Leaf.CustomErrorConstructor<{}>;
UnknowError: Leaf.CustomErrorConstructor<{}>;
NotFound: Leaf.CustomErrorConstructor<{}>;
};
export interface Blob {
name: string;
hash: string;
ext: string;
id: string;
mime?: string;
size?: number;
urls?: {
type: string;
value: string;
}[];
}
export declare namespace BlobService {
type Settings = {
blob: {
route?: string;
storage: string;
};
};
}
export declare class BlobService extends Service {
readonly name: string;
blobCollection: mongodb.Collection;
readonly dependencies: string[];
readonly collectionName: string;
services: {
MongodbService: MongodbService;
IncrementalIdService: IncrementalIdService;
ExpressService: ExpressService;
};
constructor(settings: BlobService.Settings);
initialize(done: any): void;
setAccessAuth(handler: (req: Express.Request, res: Express.Response, next: Function) => void): void;
private accessAuth;
private handleRouteDownload(req, res);
createBlob(option: {
path: string;
name: string;
}, callback: Callback): void;
private stat(path, callback);
private createPathByHash(hash);
getBlob(option: {
id: string;
}, callback: Callback): void;
}