1

How do you put the close() in the writeBuffer callback?

This question relates to: Problem with MongoDB GridFS Saving Files with Node.JS

Community
  • 1
  • 1
  • and then I read the last comment at the bottom of this one [link]http://stackoverflow.com/questions/8135718/how-to-use-gridfs-to-store-images-using-node-js-and-mongoose ... looks like the writeBuffer has since been deprecated. So how now? – Ones and Zeroes Apr 10 '12 at 16:30
  • Why don't you rewrite your question with your attempt, and updated question (instead of the comment). – Eve Freeman Apr 10 '12 at 18:11
  • oh don't just tease with a response like that... if you know the answer then please do share. ps. the answer I am looking for will come from a respondent recognizing the following: node.js, callback, close, mongodb, gridfs, – Ones and Zeroes Apr 10 '12 at 18:20

1 Answers1

2

A simple example is

https://github.com/mongodb/node-mongodb-native/blob/master/test/gridstore/grid_store_test.js#L97

Also check the docs for changes in behavior, writeBuffer was removed so just use write.

http://mongodb.github.com/node-mongodb-native/

christkv
  • 4,370
  • 23
  • 21
  • Thanks. I guess that's why I still haven't figured out how to put the close() in the writeBuffer callback, however I was able to get the desired result using a "return file.writeFile(path, fn);" as per an example I found here: https://github.com/jamescarr/nodejs-mongodb-streaming – Ones and Zeroes Apr 19 '12 at 08:03