Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GridFSBucket

Constructor for a streaming GridFS interface

Hierarchy层级

Index索引

Constructors构造函数

constructor

Events事件

Static Readonly INDEX

INDEX: "index" = ...

When the first call to openUploadStream is made, the upload stream will check to see if it needs to create the proper indexes on the chunks and files collections. This event is fired either when 1) it determines that no index creation is necessary, 2) when it successfully creates the necessary indexes.

Properties属性

s

internal

Static Readonly captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods方法

addListener

delete

drop

  • drop(): Promise<void>
  • drop(callback: Callback<void>): void

emit

  • emit<EventKey>(event: symbol | EventKey, ...args: Parameters<GridFSBucketEvents[EventKey]>): boolean

eventNames

  • eventNames(): string[]

find

getLogger

getMaxListeners

  • getMaxListeners(): number

listenerCount

  • listenerCount<EventKey>(type: string | symbol | EventKey): number

listeners

off

on

once

openDownloadStream

openDownloadStreamByName

  • Returns a readable stream (GridFSBucketReadStream) for streaming the file with the given name from GridFS. If there are multiple files with the same name, this will stream the most recent file with the given name (as determined by the uploadDate field). You can set the revision option to change this behavior.

    Parameters参数

    Returns返回GridFSBucketReadStream

openUploadStream

  • Returns a writable stream (GridFSBucketWriteStream) for writing buffers to GridFS. The stream's 'id' property contains the resulting file's id.

    Parameters参数

    Returns返回GridFSBucketWriteStream

openUploadStreamWithId

prependListener

prependOnceListener

rawListeners

  • rawListeners<EventKey>(event: string | symbol | EventKey): GridFSBucketEvents[EventKey][]

removeAllListeners

  • removeAllListeners<EventKey>(event?: string | symbol | EventKey): GridFSBucket

removeListener

rename

  • rename(id: ObjectId, filename: string): Promise<void>
  • rename(id: ObjectId, filename: string, callback: Callback<void>): void
  • Renames the file with the given _id to the given string

    Parameters参数

    • id: ObjectId

      the id of the file to rename

    • filename: string

      new name for the file

    Returns返回Promise<void>

  • Parameters参数

    Returns返回void

setMaxListeners

Static getEventListener

  • getEventListener(emitter: DOMEventTarget | EventEmitter, name: string | symbol): Function[]
  • Returns a list listener for a specific emitter event name.

    Parameters参数

    • emitter: DOMEventTarget | EventEmitter
    • name: string | symbol

    Returns返回Function[]

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters参数

    • emitter: EventEmitter
    • event: string | symbol

    Returns返回number

Static on

  • on(emitter: EventEmitter, event: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>
  • Parameters参数

    • emitter: EventEmitter
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns返回AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>
  • once(emitter: DOMEventTarget, event: string, options?: StaticEventEmitterOptions): Promise<any[]>
  • Parameters参数

    • emitter: NodeEventTarget
    • event: string | symbol
    • Optional options: StaticEventEmitterOptions

    Returns返回Promise<any[]>

  • Parameters参数

    • emitter: DOMEventTarget
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns返回Promise<any[]>

Generated using TypeDoc