gridform icon indicating copy to clipboard operation
gridform copied to clipboard

Its possible save in database from external file?

Open CodersBrothers opened this issue 11 years ago • 1 comments

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?

CodersBrothers avatar Aug 08 '13 17:08 CodersBrothers

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.

Awk34 avatar Nov 05 '14 00:11 Awk34