API Docs for:
Show:

utils.GridSQL Class

Defined in: utils/GridSQL.js:6
Module: filesize

MongoDB's GridFS inspired data storage for Knex. The given file is saved to multiple binary columns in order to enable proper file streaming.

GridSQL works like a key value store. All files must be written with an unique file id.

Constructor

utils.GridSQL

(
  • options
)

Defined in utils/GridSQL.js:6

Parameters:

  • options Object
    • knex Object

      Knex instance

    • [chunkSize=(1024*255)] Object optional

      Chunk size

    • [tableName=chunks] Object optional

      Table name

Item Index

Methods

Methods

read

(
  • fileId
)
stream.Readable

Defined in utils/GridSQL.js:31

Read file as a node.js readable stream.

This method has a little bug https://github.com/tgriesser/knex/issues/484

Parameters:

  • fileId String

Returns:

stream.Readable:

write

(
  • fileId
  • readable
  • [options]
)
Bluebird.Promise

Defined in utils/GridSQL.js:65

Write node.js readable stream database with a unique file id

Parameters:

  • fileId String
  • readable stream.Writable
  • [options] Object optional
    • [chunkSize] Object optional

      Custom chunks size for this file

Returns:

Bluebird.Promise:

The returned promise is resolved when the readable stream is fully saved to the database