gridfs.client.js 774 B

123456789101112131415161718192021
  1. /**
  2. * @public
  3. * @constructor
  4. * @param {String} name - The store name
  5. * @param {Object} options
  6. * @param {Function} [options.beforeSave] - Function to run before saving a file from the client. The context of the function will be the `FS.File` instance we're saving. The function may alter its properties.
  7. * @param {Number} [options.maxTries=5] - Max times to attempt saving a file
  8. * @returns {undefined}
  9. *
  10. * Creates a GridFS store instance on the client, which is just a shell object
  11. * storing some info.
  12. */
  13. FS.Store.GridFS = function(name, options) {
  14. var self = this;
  15. if (!(self instanceof FS.Store.GridFS))
  16. throw new Error('FS.Store.GridFS missing keyword "new"');
  17. return new FS.StorageAdapter(name, options, {
  18. typeName: 'storage.gridfs'
  19. });
  20. };