Created
January 13, 2016 00:25
-
-
Save vicatcu/5a843801a3b0e3f919f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Promise.try(function () { | |
//return fs.readFileAsync(status.filename, 'utf8'); | |
return MongoClient.connectAsync(MONGODB_CONNECTION_STRING).then(function(db){ | |
var results = null; | |
return Promise.try(function(){ | |
return db.collection("downloads").findOneAsync({key: status.filename}); | |
}).then(function(item){ | |
results = item; | |
return db.closeAsync(); | |
}).then(function(){ | |
return results; | |
}); | |
}); | |
}).then(function(content) { | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment