# @types/gridfs-stream

> TypeScript definitions for gridfs-stream

Latest version **0.5.39** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/gridfs-stream
pnpm add @types/gridfs-stream
yarn add @types/gridfs-stream
bun add @types/gridfs-stream
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.5.39 |
| Published | 2023-11-07 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51438 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/gridfs-stream
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gridfs-stream
- npm.io page: https://npm.io/package/@types/gridfs-stream

## Dependencies (2)

- [mongodb](https://npm.io/package/mongodb.md) ^4.5.0
- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 0.5.39 (latest) — 2023-11-07
- 0.5.36 (ts4.1) — 2022-04-22
- 0.5.35 (ts3.6) — 2021-07-26
- 0.5.33 (ts3.2) — 2020-04-24
- 0.5.32 (ts3.0) — 2019-10-03
- 0.5.31 (ts2.8) — 2019-08-07
- 0.5.30 (ts2.3) — 2017-08-21
- 0.5.28 (ts2.0) — 2016-09-19
- 0.5.38 — 2023-10-18
- 0.5.37 — 2023-09-20
- 0.5.34 — 2021-07-08
- 0.5.29 — 2017-06-07
- 0.5.27 — 2016-07-14
- 0.5.26-alpha — 2016-07-08
- 0.5.25-alpha — 2016-07-04
- … 7 more at https://npm.io/package/@types/gridfs-stream/versions

## README

# 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](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gridfs-stream/index.d.ts)
````ts
/// <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
 * Last updated: Tue, 07 Nov 2023 03:09:37 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node), [mongodb](https://npmjs.com/package/mongodb)

# Credits
These definitions were written by [Lior Mualem](https://github.com/liorm).

---
_Source: https://npm.io/package/@types/gridfs-stream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
