lost+found/src/websvr.js
function (filePath) {
                    var
                        me = this,
                        extName = _path.extname(filePath).toLowerCase(),
                        size,
                        stream;
                    _fs.stat(filePath, function (err, stats) {
                        var mimeType;
                        if (err) {
                            me._response.plain(500,
                                "Unable to access file (" + err + ")");
                            return;
                        }
                        if (stats.isDirectory()) {
                            me._response.plain(200, "Directory.");
                            return;
                        } else if (!stats.isFile()) {
                            me._response.plain(200, "Not a file.");
                            return;
                        }
                        size = stats.size;
                        mimeType = gpf.http.getMimeType(extName);
                        if (me._options.verbose) {
                            console.log("\tMime type  : " + mimeType);
                            console.log("\tFile size  : " + size);
                        }
                        me._response.writeHead(200, {
                            "content-type": mimeType,
                            "content-length": size
                        });
                        stream = _fs.createReadStream(filePath);
                        //stream.on("data", function (chunk) {
                        //    if (!me._response.write(chunk)) {
                        //        stream.pause();
                        //        me._response.once("drain", function () {
                        //            stream.resume();
                        //        });
                        //    }
                        //});
                        stream.on("end", function () {
                            if (me._options.verbose) {
                                console.log("\tEnd      t+: "
                                + ((new Date()) - me._startTimeStamp)
                                + "ms");
                            }
                            me._response.statusCode = 200;
                            me._response.end();
                        });
                        stream.pipe(me._response);
                    });
                }
function (filePath) {
                    var
                        me = this,
                        extName = _path.extname(filePath).toLowerCase(),
                        size,
                        stream;
                    _fs.stat(filePath, function (err, stats) {
                        var mimeType;
                        if (err) {
                            me._response.plain(500,
                                "Unable to access file (" + err + ")");
                            return;
                        }
                        if (stats.isDirectory()) {
                            me._response.plain(200, "Directory.");
                            return;
                        } else if (!stats.isFile()) {
                            me._response.plain(200, "Not a file.");
                            return;
                        }
                        size = stats.size;
                        mimeType = gpf.http.getMimeType(extName);
                        if (me._options.verbose) {
                            console.log("\tMime type  : " + mimeType);
                            console.log("\tFile size  : " + size);
                        }
                        me._response.writeHead(200, {
                            "content-type": mimeType,
                            "content-length": size
                        });
                        stream = _fs.createReadStream(filePath);
                        //stream.on("data", function (chunk) {
                        //    if (!me._response.write(chunk)) {
                        //        stream.pause();
                        //        me._response.once("drain", function () {
                        //            stream.resume();
                        //        });
                        //    }
                        //});
                        stream.on("end", function () {
                            if (me._options.verbose) {
                                console.log("\tEnd      t+: "
                                + ((new Date()) - me._startTimeStamp)
                                + "ms");
                            }
                            me._response.statusCode = 200;
                            me._response.end();
                        });
                        stream.pipe(me._response);
                    });
                }
function ( filePath ) { var me = this , extName = _path . extname ( filePath ) . toLowerCase ( ) , size , stream ; _fs . stat ( filePath , function ( err , stats ) { var mimeType ; if ( err ) { me . _response . plain ( 500 , "Unable to access file (" + err + ")" ) ; return ; } if ( stats . isDirectory ( ) ) { me . _response . plain ( 200 , "Directory." ) ; return ; } else if ( ! stats . isFile ( ) ) { me . _response . plain ( 200 , "Not a file." ) ; return ; } size = stats . size ; mimeType = gpf . http . getMimeType ( extName ) ; if ( me . _options . verbose ) { console . log ( "\tMime type  : " + mimeType ) ; console . log ( "\tFile size  : " + size ) ; } me . _response . writeHead ( 200 , { "content-type" : mimeType , "content-length" : size } ) ; stream = _fs . createReadStream ( filePath ) ; //stream.on("data", function (chunk) { //    if (!me._response.write(chunk)) { //        stream.pause(); //        me._response.once("drain", function () { //            stream.resume(); //        }); //    } //}); stream . on ( "end" , function ( ) { if ( me . _options . verbose ) { console . log ( "\tEnd      t+: " + ( ( new Date ( ) ) - me . _startTimeStamp ) + "ms" ) ; } me . _response . statusCode = 200 ; me . _response . end ( ) ; } ) ; stream . pipe ( me . _response ) ; } ) ; }
Generates a response that contains the specified file

@param {String} filePath
@private
Generates a response that contains the specified file