gridform
gridform copied to clipboard
Its possible save in database from external file?
I want put a url and read sourcecode and save in gridfs. I use this function to read sourceCodes:
function getSourceCode(url, callback){
// Obtenemos el código fuente
http.get(url, function(res) {
// Mientras va recibiendo añade el dato a una variable
var body = '';
res.on('data', function(chunk) {
body += chunk;
});
// Cuando esté obtenido
res.on('end', function() {
// Devolvemos al callback el código fuente
callback(null, body);
});
}).on('error', function(err) {
// En caso de error
myUtils.handError(err);
// Devolvemos al callback
callback({
code: "GET SOURCE CODE",
message: "Was imposible get surce code"
});
});
}
I can connect this as stream to gridform?
No, gridform is for taking in form data and directly streaming it to GridFS. What you probably want is something to write directly to GridFS from data that you have, not submitted form data.