Cleanup
This commit is contained in:
67
node_modules/mongodb/lib/gridfs-stream/index.js
generated
vendored
67
node_modules/mongodb/lib/gridfs-stream/index.js
generated
vendored
@@ -7,6 +7,7 @@ var shallowClone = require('../utils').shallowClone;
|
||||
var toError = require('../utils').toError;
|
||||
var util = require('util');
|
||||
var executeLegacyOperation = require('../utils').executeLegacyOperation;
|
||||
const deprecateOptions = require('../utils').deprecateOptions;
|
||||
|
||||
var DEFAULT_GRIDFS_BUCKET_OPTIONS = {
|
||||
bucketName: 'fs',
|
||||
@@ -79,21 +80,28 @@ util.inherits(GridFSBucket, Emitter);
|
||||
* @param {object} [options.metadata] Optional object to store in the file document's `metadata` field
|
||||
* @param {string} [options.contentType] Optional string to store in the file document's `contentType` field
|
||||
* @param {array} [options.aliases] Optional array of strings to store in the file document's `aliases` field
|
||||
* @param {boolean} [options.disableMD5=false] If true, disables adding an md5 field to file data
|
||||
* @param {boolean} [options.disableMD5=false] **Deprecated** If true, disables adding an md5 field to file data
|
||||
* @return {GridFSBucketWriteStream}
|
||||
*/
|
||||
|
||||
GridFSBucket.prototype.openUploadStream = function(filename, options) {
|
||||
if (options) {
|
||||
options = shallowClone(options);
|
||||
} else {
|
||||
options = {};
|
||||
GridFSBucket.prototype.openUploadStream = deprecateOptions(
|
||||
{
|
||||
name: 'GridFSBucket.openUploadStream',
|
||||
deprecatedOptions: ['disableMD5'],
|
||||
optionsIndex: 1
|
||||
},
|
||||
function(filename, options) {
|
||||
if (options) {
|
||||
options = shallowClone(options);
|
||||
} else {
|
||||
options = {};
|
||||
}
|
||||
if (!options.chunkSizeBytes) {
|
||||
options.chunkSizeBytes = this.s.options.chunkSizeBytes;
|
||||
}
|
||||
return new GridFSBucketWriteStream(this, filename, options);
|
||||
}
|
||||
if (!options.chunkSizeBytes) {
|
||||
options.chunkSizeBytes = this.s.options.chunkSizeBytes;
|
||||
}
|
||||
return new GridFSBucketWriteStream(this, filename, options);
|
||||
};
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns a writable stream (GridFSBucketWriteStream) for writing
|
||||
@@ -107,25 +115,32 @@ GridFSBucket.prototype.openUploadStream = function(filename, options) {
|
||||
* @param {object} [options.metadata] Optional object to store in the file document's `metadata` field
|
||||
* @param {string} [options.contentType] Optional string to store in the file document's `contentType` field
|
||||
* @param {array} [options.aliases] Optional array of strings to store in the file document's `aliases` field
|
||||
* @param {boolean} [options.disableMD5=false] If true, disables adding an md5 field to file data
|
||||
* @param {boolean} [options.disableMD5=false] **Deprecated** If true, disables adding an md5 field to file data
|
||||
* @return {GridFSBucketWriteStream}
|
||||
*/
|
||||
|
||||
GridFSBucket.prototype.openUploadStreamWithId = function(id, filename, options) {
|
||||
if (options) {
|
||||
options = shallowClone(options);
|
||||
} else {
|
||||
options = {};
|
||||
GridFSBucket.prototype.openUploadStreamWithId = deprecateOptions(
|
||||
{
|
||||
name: 'GridFSBucket.openUploadStreamWithId',
|
||||
deprecatedOptions: ['disableMD5'],
|
||||
optionsIndex: 2
|
||||
},
|
||||
function(id, filename, options) {
|
||||
if (options) {
|
||||
options = shallowClone(options);
|
||||
} else {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (!options.chunkSizeBytes) {
|
||||
options.chunkSizeBytes = this.s.options.chunkSizeBytes;
|
||||
}
|
||||
|
||||
options.id = id;
|
||||
|
||||
return new GridFSBucketWriteStream(this, filename, options);
|
||||
}
|
||||
|
||||
if (!options.chunkSizeBytes) {
|
||||
options.chunkSizeBytes = this.s.options.chunkSizeBytes;
|
||||
}
|
||||
|
||||
options.id = id;
|
||||
|
||||
return new GridFSBucketWriteStream(this, filename, options);
|
||||
};
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns a readable stream (GridFSBucketReadStream) for streaming file
|
||||
|
||||
Reference in New Issue
Block a user