lib/onyx.js
function xfer (res, files, cb) {
    var file = files.shift();

    if (!file) {
        return cb(null);
    }

    fs.createReadStream(file
    ).on("data", function (chunk) {
        res.write(chunk);
    }).on("error", cb
    ).on("close", function xferClose () {
        xfer(res, files, cb);
    });
}
function xfer (res, files, cb) {
    var file = files.shift();

    if (!file) {
        return cb(null);
    }

    fs.createReadStream(file
    ).on("data", function (chunk) {
        res.write(chunk);
    }).on("error", cb
    ).on("close", function xferClose () {
        xfer(res, files, cb);
    });
}
function xfer ( res , files , cb ) { var file = files . shift ( ) ; if ( ! file ) { return cb ( null ) ; } fs . createReadStream ( file ) . on ( "data" , function ( chunk ) { res . write ( chunk ) ; } ) . on ( "error" , cb ) . on ( "close" , function xferClose ( ) { xfer ( res , files , cb ) ; } ) ; }
Implementation of the actual file transfer.
Implementation of the actual file transfer .