lib/gridFileManager.js
function updateExistingFile(db, fileName, fileReadStream, options, cb) {
  defaultLogger.debug("In updateExistingFile");

  getFileDetails(db, {"groupId": options.groupId}, {}, function(err, fileInfo) {
    if (err) {
      defaultLogger.error(err); return cb(err);
    }
    var latestFileVersion = fileInfo.metadata.version;
    incrementFileVersion(latestFileVersion, function(newFileVersion) {
      if (!newFileVersion) {
        return cb(new Error("File version was not incremented for file " + fileName));
      }
      defaultLogger.debug("New File Version ", newFileVersion);
      createFileWithVersion(db, fileName, fileReadStream, newFileVersion, options, cb);
    });
  });
}
function updateExistingFile(db, fileName, fileReadStream, options, cb) {
  defaultLogger.debug("In updateExistingFile");

  getFileDetails(db, {"groupId": options.groupId}, {}, function(err, fileInfo) {
    if (err) {
      defaultLogger.error(err); return cb(err);
    }
    var latestFileVersion = fileInfo.metadata.version;
    incrementFileVersion(latestFileVersion, function(newFileVersion) {
      if (!newFileVersion) {
        return cb(new Error("File version was not incremented for file " + fileName));
      }
      defaultLogger.debug("New File Version ", newFileVersion);
      createFileWithVersion(db, fileName, fileReadStream, newFileVersion, options, cb);
    });
  });
}
function updateExistingFile ( db , fileName , fileReadStream , options , cb ) { defaultLogger . debug ( "In updateExistingFile" ) ; getFileDetails ( db , { "groupId" : options . groupId } , { } , function ( err , fileInfo ) { if ( err ) { defaultLogger . error ( err ) ; return cb ( err ) ; } var latestFileVersion = fileInfo . metadata . version ; incrementFileVersion ( latestFileVersion , function ( newFileVersion ) { if ( ! newFileVersion ) { return cb ( new Error ( "File version was not incremented for file " + fileName ) ) ; } defaultLogger . debug ( "New File Version " , newFileVersion ) ; createFileWithVersion ( db , fileName , fileReadStream , newFileVersion , options , cb ) ; } ) ; } ) ; }
Updating an existing file means that the new file is saved with the same name with an incremented version.
Updating an existing file means that the new file is saved with the same name with an incremented version .