Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MongoGridFsClient

Hierarchy

  • MongoGridFsClient

Index

Methods

close

  • close(): void
  • Close the client and release its resources

    Returns void

delete

  • delete(id: string): PromiseLike<void>
  • delete(id: string, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): MongoGridFsClient
  • Deletes a file by it's ID

    Parameters

    • id: string

    Returns PromiseLike<void>

  • Deletes a file by it's ID

    Parameters

    • id: string
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns MongoGridFsClient

downloadByFileName

  • downloadByFileName(stream: WriteStream<Buffer>, fileName: string): PromiseLike<number>
  • downloadByFileName(stream: WriteStream<Buffer>, fileName: string, resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>): MongoGridFsClient
  • Parameters

    • stream: WriteStream<Buffer>
    • fileName: string

    Returns PromiseLike<number>

  • Parameters

    • stream: WriteStream<Buffer>
    • fileName: string
    • resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>

    Returns MongoGridFsClient

downloadByFileNameWithOptions

  • downloadByFileNameWithOptions(stream: WriteStream<Buffer>, fileName: string, options: GridFsDownloadOptions): PromiseLike<number>
  • downloadByFileNameWithOptions(stream: WriteStream<Buffer>, fileName: string, options: GridFsDownloadOptions, resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>): MongoGridFsClient
  • Parameters

    Returns PromiseLike<number>

  • Parameters

    • stream: WriteStream<Buffer>
    • fileName: string
    • options: GridFsDownloadOptions
    • resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>

    Returns MongoGridFsClient

downloadById

  • downloadById(stream: WriteStream<Buffer>, id: string): PromiseLike<number>
  • downloadById(stream: WriteStream<Buffer>, id: string, resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>): MongoGridFsClient
  • Parameters

    • stream: WriteStream<Buffer>
    • id: string

    Returns PromiseLike<number>

  • Parameters

    • stream: WriteStream<Buffer>
    • id: string
    • resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>

    Returns MongoGridFsClient

downloadFile

  • downloadFile(fileName: string): PromiseLike<number>
  • downloadFile(fileName: string, resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>): MongoGridFsClient
  • Downloads a file.

    Parameters

    • fileName: string

    Returns PromiseLike<number>

  • Downloads a file.

    Parameters

    • fileName: string
    • resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>

    Returns MongoGridFsClient

downloadFileAs

  • downloadFileAs(fileName: string, newFileName: string): PromiseLike<number>
  • downloadFileAs(fileName: string, newFileName: string, resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>): MongoGridFsClient
  • Downloads a file and gives it a new name.

    Parameters

    • fileName: string
    • newFileName: string

    Returns PromiseLike<number>

  • Downloads a file and gives it a new name.

    Parameters

    • fileName: string
    • newFileName: string
    • resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>

    Returns MongoGridFsClient

downloadFileByID

  • downloadFileByID(id: string, fileName: string): PromiseLike<number>
  • downloadFileByID(id: string, fileName: string, resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>): MongoGridFsClient
  • Downloads a file using the ID generated by GridFs.

    Parameters

    • id: string
    • fileName: string

    Returns PromiseLike<number>

  • Downloads a file using the ID generated by GridFs.

    Parameters

    • id: string
    • fileName: string
    • resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>

    Returns MongoGridFsClient

drop

  • drop(): PromiseLike<void>
  • drop(resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): MongoGridFsClient
  • Drops the entire file bucket with all of its contents

    Returns PromiseLike<void>

  • Drops the entire file bucket with all of its contents

    Parameters

    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns MongoGridFsClient

findAllIds

  • findAllIds(): PromiseLike<string>
  • findAllIds(resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>): MongoGridFsClient
  • Finds all file ids in the bucket

    Returns PromiseLike<string>

  • Finds all file ids in the bucket

    Parameters

    • resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>

    Returns MongoGridFsClient

findIds

  • findIds(query: {}): PromiseLike<string>
  • findIds(query: {}, resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>): MongoGridFsClient
  • Finds all file ids that match a query.

    Parameters

    • query: {}
      • [key: string]: any

    Returns PromiseLike<string>

  • Finds all file ids that match a query.

    Parameters

    • query: {}
      • [key: string]: any
    • resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>

    Returns MongoGridFsClient

readByFileName

  • readByFileName(fileName: string): ReadStream<Buffer>
  • Read file by name to ReadStream

    Parameters

    • fileName: string

    Returns ReadStream<Buffer>

readByFileNameWithOptions

  • Read file by name to ReadStream with options

    Parameters

    Returns ReadStream<Buffer>

readById

  • readById(id: string): ReadStream<Buffer>
  • Read file by id to ReadStream

    Parameters

    • id: string

    Returns ReadStream<Buffer>

uploadByFileName

  • uploadByFileName(stream: ReadStream<Buffer>, fileName: string): PromiseLike<string>
  • uploadByFileName(stream: ReadStream<Buffer>, fileName: string, resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>): MongoGridFsClient
  • Parameters

    • stream: ReadStream<Buffer>
    • fileName: string

    Returns PromiseLike<string>

  • Parameters

    • stream: ReadStream<Buffer>
    • fileName: string
    • resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>

    Returns MongoGridFsClient

uploadByFileNameWithOptions

  • uploadByFileNameWithOptions(stream: ReadStream<Buffer>, fileName: string, options: GridFsUploadOptions): PromiseLike<string>
  • uploadByFileNameWithOptions(stream: ReadStream<Buffer>, fileName: string, options: GridFsUploadOptions, resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>): MongoGridFsClient
  • Parameters

    Returns PromiseLike<string>

  • Parameters

    • stream: ReadStream<Buffer>
    • fileName: string
    • options: GridFsUploadOptions
    • resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>

    Returns MongoGridFsClient

uploadFile

  • uploadFile(fileName: string): PromiseLike<string>
  • uploadFile(fileName: string, resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>): MongoGridFsClient
  • Upload a file to gridfs

    Parameters

    • fileName: string

    Returns PromiseLike<string>

  • Upload a file to gridfs

    Parameters

    • fileName: string
    • resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>

    Returns MongoGridFsClient

uploadFileWithOptions

  • Upload a file to gridfs with options

    Parameters

    Returns PromiseLike<string>

  • Upload a file to gridfs with options

    Parameters

    • fileName: string
    • options: GridFsUploadOptions
    • resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>

    Returns MongoGridFsClient

Generated using TypeDoc