@types/multer-gridfs-storage v4.0.8
Installation
npm install --save @types/multer-gridfs-storage
Summary
This package contains type definitions for multer-gridfs-storage (https://github.com/devconcept/multer-gridfs-storage).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/multer-gridfs-storage/v1.
index.d.ts
// Type definitions for multer-gridfs-storage 1.1
// Project: https://github.com/devconcept/multer-gridfs-storage
// Definitions by: devconcept <https://github.com/devconcept>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 4.1
import { EventEmitter } from 'events';
import { Express } from 'express';
import * as Multer from 'multer';
import { Grid } from 'gridfs-stream';
type logConfig = 'file' | 'all';
interface StorageLog {
message: string;
extra: any;
}
type NodeCb<T> = (err: Error | null, value: T | null) => void;
type ConfigFn<T> = (req: Express.Request, file: Express.Multer.File, cb: T) => void;
// TODO: PR and add this interface to the mongodb types
interface GridFile {
_id: any;
filename: string;
contentType: string;
length: number;
chunkSize: number;
uploadDate: Date;
aliases: any;
metadata: any;
md5: string;
}
interface MulterGfsOptions {
filename?: ConfigFn<NodeCb<string>> | undefined;
identifier?: ConfigFn<NodeCb<any>> | undefined;
metadata?: ConfigFn<NodeCb<any>> | undefined;
chunkSize?: number | ConfigFn<NodeCb<number>> | undefined;
root?: string | ConfigFn<NodeCb<string>> | undefined;
log?: boolean | NodeCb<StorageLog> | undefined;
logLevel?: logConfig | undefined;
}
declare class MulterGridfsStorage extends EventEmitter implements Multer.StorageEngine {
constructor(settings: MulterGridfsStorage.UrlStorageOptions | MulterGridfsStorage.GfsStorageOptions);
_handleFile(req: Express.Request, file: Express.Multer.File, callback: (error?: any, info?: Express.Multer.File) => void): void;
_removeFile(req: Express.Request, file: Express.Multer.File, callback: (error: Error) => void): void;
}
declare namespace MulterGridfsStorage {
interface UrlStorageOptions extends MulterGfsOptions {
url: string;
}
interface GfsStorageOptions extends MulterGfsOptions {
gfs: Promise<Grid> | Grid;
}
}
// Merge multer's file declaration with ours
declare global {
namespace Express {
namespace Multer {
interface File {
filename: string;
metadata: any;
id: any;
grid: GridFile;
size: number;
}
}
}
}
export = MulterGridfsStorage;
Additional Details
- Last updated: Fri, 22 Apr 2022 19:01:40 GMT
- Dependencies: @types/express, @types/multer, @types/gridfs-stream
- Global values: none
Credits
These definitions were written by devconcept.
6 months ago
7 months ago
8 months ago
7 months ago
8 months ago
6 months ago
7 months ago
6 months ago
8 months ago
7 months ago
8 months ago
6 months ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago