code: function createStreamProtocolResponse(filePath, res, beforeFinalize) {
      if (!fs.existsSync(filePath)) {
          return;
      }
  
      // Setting file size.
      const stat = fs.statSync(filePath);
      res.setHeader('Content-Length', stat.size);
  
      // Setting last modified date.
      const modified = stat.mtime.toUTCString();
      res.setHeader('Last-Modified', modified);
  
      // Determining mime type.
      const type = mime.getType(filePath);
      if (type) {
          const charset = mime.getExtension(type);
          res.setHeader('Content-Type', type + (charset ? `; charset=${charset}` : ''));
      } else {
          res.setHeader('Content-Type', 'application/octet-stream');
      }
  
      res.setHeader('Connection', 'close');
      res.setStream(fs.createReadStream(filePath));
      res.setStatusCode(200);
  
      beforeFinalize();
      res.finalize();
  }
docs: Creates stream protocol response for a given file acting like it would come
  from a real HTTP server.
  
  @param {string} filePath            - path to the file being sent
  @param {StreamProtocolResponse} res - the response object
  @param {Function} beforeFinalize    - function to be run before finalizing the response object