Firebird.attach(options, function(err, db) { if (err) throw err; // db = DATABASE db.query('SELECT ID, ALIAS, USERPICTURE FROM USER', function(err, rows) { if (err) throw err; // first row rows[0].userpicture(function(err, name, e) { if (err) throw err; // +v0.2.4 // e.pipe(writeStream/Response); // e === EventEmitter e.on('data', function(chunk) { // reading data }); e.on('end', function() { // end reading // IMPORTANT: close the connection db.detach(); }); }); });});