0.5.39 • Published 2 years ago

@types/gridfs-stream v0.5.39

Weekly downloads
1,773
License
MIT
Repository
github
Last release
2 years ago

Installation

npm install --save @types/gridfs-stream

Summary

This package contains type definitions for gridfs-stream (https://github.com/aheckmann/gridfs-stream).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gridfs-stream.

index.d.ts

// Type definitions for gridfs-stream 0.5.0
// Project: https://github.com/aheckmann/gridfs-stream
// Definitions by: Lior Mualem <https://github.com/liorm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 4.1

/// <reference types="node" />

declare namespace GridFSStream {
    export interface Range {
        startPos: number;
        endPos: number;
    }

    export interface Options {
        _id?: string | undefined;
        filename?: string | undefined;
        mode?: string | undefined;

        range?: Range | undefined;

        // any other options from the GridStore may be passed too, e.g.
        chunkSize?: number | undefined;
        content_type?: string | undefined;
        root?: string | undefined;
        metadata?: any;
    }

    export interface WriteStream extends NodeJS.WritableStream {
        writable: boolean;
        name: string;
        id: string;
        options: Options;
        mode: string;
    }

    export interface ReadStream extends NodeJS.ReadableStream {
        readable: boolean;
        paused: boolean;
    }
}


import mongo = require('mongodb');

// Merged declaration, g is both a callable function and a namespace
declare function g(db: any, mongo: any): g.Grid;

declare namespace g {

    export class Grid {

        files: mongo.Collection;
        collection(name?: string): mongo.Collection;
        curCol: string;

        createWriteStream(options?: GridFSStream.Options): GridFSStream.WriteStream;
        createReadStream(options?: GridFSStream.Options): GridFSStream.ReadStream;
        createWriteStream(options?: string): GridFSStream.WriteStream;
        createReadStream(options?: string): GridFSStream.ReadStream;

        remove(options: GridFSStream.Options, callback: (err: Error) => void): void;
        exist(options: GridFSStream.Options, callback: (err: Error, found: boolean) => void): void;
        findOne(options: GridFSStream.Options, callback: (err: Error, record: any)=>void):void;
    }
}

export = g;

Additional Details

Credits

These definitions were written by Lior Mualem.

0.5.38

2 years ago

0.5.39

2 years ago

0.5.37

2 years ago

0.5.36

3 years ago

0.5.35

4 years ago

0.5.34

4 years ago

0.5.33

5 years ago

0.5.32

6 years ago

0.5.31

6 years ago

0.5.30

8 years ago

0.5.29

8 years ago

0.5.28

9 years ago

0.5.27

9 years ago

0.5.26-alpha

9 years ago

0.5.25-alpha

9 years ago

0.5.24-alpha

9 years ago

0.5.23-alpha

9 years ago

0.5.22-alpha

9 years ago

0.5.21-alpha

9 years ago

0.5.20-alpha

9 years ago

0.5.15-alpha

9 years ago

0.5.14-alpha

9 years ago