Permalink
Browse files

fix gridfs

  • Loading branch information...
1 parent b0c7881 commit 61c35eb245bfbb46c241ac199130d87c4e065b57 @guileen committed Mar 23, 2012
Showing with 9 additions and 7 deletions.
  1. +1 −1 examples/gridfs.js
  2. +8 −6 lib/mongoskin/gridfs.js
View
@@ -5,7 +5,7 @@ db.gridfs().open('test.txt', 'w', function(err, gs) {
gs.close(function(err, reply){
db.gridfs().open('test.txt', 'r' ,function(err, gs) {
gs.read(function(err, reply){
- console.log(reply);
+ console.log(reply.toString());
});
});
});
View
@@ -8,16 +8,18 @@ var SkinGridStore = exports.SkinGridStore = function(skinDb) {
}
/**
- * @param filename: filename or ObjectId
+ * @param id
+ * @param filename
+ * @param mode
+ * @param options
+ * @param callback
* callback(err, gridStoreObject)
*/
SkinGridStore.prototype.open = function(id, filename, mode, options, callback){
- if(!callback){
- callback = options;
- options = undefined;
- }
+ var args = Array.prototype.slice.call(arguments);
+ var callback = args.pop();
this.skinDb.open(function(err, db) {
- new GridStore(db, id, filename, mode, options).open(callback);
+ new GridStore(db, args[0], args[1], args[2], args[3]).open(callback);
});
}

0 comments on commit 61c35eb

Please sign in to comment.