public function rawReadOnly($product, $name, $version, $route) { $query = Flight::request()->query; $path = '/' . $this->getSplat($route); $pkg = new Pkg(); $ret = $pkg->downloadFile($path, $query->home); if (is_int($ret)) { Flight::json(null, $ret); } else { if (strpos($ret['header'], 'application/octet-stream') !== false) { header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($path) . '"'); } else { header('Content-Type: text/plain; charset=utf-8'); } echo $ret['body']; } }