Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
readme.md239 linesDownload Raw Back to sirv
1# sirv ![CI](https://github.com/lukeed/sirv/workflows/CI/badge.svg)2 3> The optimized and lightweight middleware for serving requests to static assets4 5You may use `sirv` as a *very* fast and lightweight alternative to [`serve-static`](https://www.npmjs.com/package/serve-static).6 7The massive performance advantage over `serve-static` is explained by **not** relying on the file system for existence checks on every request. These are expensive interactions and must be avoided whenever possible! Instead, when not in "dev" mode, `sirv` performs all its file-system operations upfront and then relies on its cache for future operations.8 9This middleware will work out of the box for [Polka](https://github.com/lukeed/polka), Express, and other Express-like frameworks. It will also work with the native `http`, `https` and `http2` modules. It requires _very_ little effort to modify/wrap it for servers that don't accept the `(req, res, next)` signature.10 11:bulb: For a feature-complete CLI application, check out the sibling [`sirv-cli`](https://github.com/lukeed/sirv/tree/master/packages/sirv-cli) package as an alternative to [`zeit/serve`](https://github.com/zeit/serve)~!12 13## Install14 15```16$ npm install --save sirv17```18 19 20## Usage21 22```js23const sirv = require('sirv');24const polka = require('polka');25const compress = require('compression')();26 27// Init `sirv` handler28const assets = sirv('public', {29  maxAge: 31536000, // 1Y30  immutable: true31});32 33polka()34  .use(compress, assets)35  .use('/api', require('./api'))36  .listen(3000, err => {37    if (err) throw err;38    console.log('> Ready on localhost:3000~!');39  });40```41 42 43## API44 45### sirv(dir, opts={})46 47Returns: `Function`48 49The returned function is a middleware in the standard Express-like signature: `(req, res, next)`, where `req` is the [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage), `res` is the [`http.ServerResponse`](https://nodejs.org/dist/latest-v9.x/docs/api/http.html#http_class_http_serverresponse), and `next` (in this case) is the function to call if no file was found for the given path.50 51When defined, a `next()` callback is always called _instead of_ the [`opts.onNoMatch`](#optsonnomatch) callback. However, unlike `onNoMatch`, your `next()` is given no arguments.52 53#### dir54Type: `String`<br>55Default: `.`56 57The directory from which to read and serve assets. It is resolved to an absolute path &mdash; you must provide an absolute path yourself if `process.cwd()` is not the correct assumption.58 59#### opts.dev60Type: `Boolean`<br>61Default: `false`62 63Enable "dev" mode, which disables/skips caching. Instead, `sirv` will traverse the file system ***on every request***.64 65Additionally, `dev` mode will ignore `maxAge` and `immutable` as these options generate a production-oriented `Cache-Control` header value.66 67> **Important:** Do not use `dev` mode in production!68 69#### opts.etag70Type: `Boolean`<br>71Default: `false`72 73Generate and attach an `ETag` header to responses.74 75> **Note:** If an incoming request's [`If-None-Match` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match) matches the `ETag` value, a `304` response is given.76 77#### opts.dotfiles78Type: `Boolean`<br>79Default: `false`80 81Allow requests to dotfiles (files or directories beginning with a `.`).82 83> **Note:** Requests to [`/.well-known/*`](https://tools.ietf.org/html/rfc8615) are always allowed.84 85#### opts.extensions86Type: `Array<String>`<br>87Default: `['html', 'htm']`88 89The file extension fallbacks to check for if a pathame is not initially found. For example, if a `/login` request cannot find a `login` filename, it will then look for `login.html` and `login.htm` before giving up~!90 91> **Important:** Actually, `sirv` will **also** look for `login/index.html` and `login/index.htm` before giving up.92 93#### opts.gzip94Type: `Boolean`<br>95Default: `false`96 97Determine if `sirv` look for **precompiled** `*.gz` files.<br>98Must be enabled _and_ the incoming request's [`Accept Encoding`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) must include "gzip" in order for `sirv` to search for the gzip'd alternative.99 100> **Note:** The `.gz` assumption also applies to the `opts.extensions` list.101 102```js103// NOTE: PSEUDO CODE104// Showing lookup logic105 106// Request: [Accept-Encoding: gzip] "/foobar.jpg"107lookup([108  '/foobar.jpg.gz', '/foobar.jpg',109  '/foobar.jpg.html.gz', '/foobar.jpg/index.html.gz',110  '/foobar.jpg.htm.gz', '/foobar.jpg/index.htm.gz',111  '/foobar.jpg.html', '/foobar.jpg/index.html',112  '/foobar.jpg.htm', '/foobar.jpg/index.htm',113]);114 115// Request: [Accept-Encoding: gzip] "/"116lookup([117  '/index.html.gz',118  '/index.htm.gz',119  '/index.html',120  '/index.htm',121]);122```123 124 125#### opts.brotli126Type: `Boolean`<br>127Default: `false`128 129Determine if `sirv` look for **precompiled** `*.br` files.<br>130Must be enabled _and_ the incoming request's [`Accept Encoding`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) must include either "br" or "brotli" in order for `sirv` to search for the brotli-compressed alternative.131 132> **Note:** The `.br` assumption also applies to the `opts.extensions` list.133 134When both `opts.broli` and `opts.gzip` are enabled &mdash; and all conditions are equal &mdash; then the brotli variant always takes priority.135 136```js137// NOTE: PSEUDO CODE138// Showing lookup logic139 140// Request: [Accept-Encoding: br] "/foobar.jpg"141lookup([142  '/foobar.jpg.br', '/foobar.jpg',143  '/foobar.jpg.html.br', '/foobar.jpg/index.html.br',144  '/foobar.jpg.htm.br', '/foobar.jpg/index.htm.br',145  '/foobar.jpg.html', '/foobar.jpg/index.html',146  '/foobar.jpg.htm', '/foobar.jpg/index.htm',147]);148 149// Request: [Accept-Encoding: br,gz] "/"150lookup([151  '/index.html.br'152  '/index.htm.br'153  '/index.html.gz'154  '/index.htm.gz'155  '/index.html'156  '/index.htm'157]);158```159 160#### opts.maxAge161Type: `Number`<br>162Default: `undefined`163 164Enables the `Cache-Control` header on responses and sets the `max-age` value (in seconds).<br>165For example, `maxAge: 31536000` is equivalent to one year.166 167#### opts.immutable168Type: `Boolean`<br>169Default: `false`170 171Appends the [`immutable` directive](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#Revalidation_and_reloading) on your `Cache-Control` header, used for uniquely-named assets that will not change!172 173> **Important:** Will only work if `opts.maxAge` has a value defined!174 175#### opts.single176Type: `Boolean` or `String`<br>177Default: `false`178 179Treat the directory as a single-page application.180 181When `true`, the directory's index page (default `index.html`) will be sent if the request asset does not exist.<br>182You may pass a `string` value to use a file _instead of_ `index.html` as your fallback.183 184For example, if "/about" is requested but no variants of that file exist, then the response for "/" is sent instead:185 186```js187// Note: This is psuedo code to illustrate what's happening188 189// Request: "/about"190let file = find(['/about', '/about.html', '/about.htm', '/about/index.html', '/about.htm']);191if (file) {192  send(file);193} else if (opts.single === true) {194  file = find(['/', '/index.html', '/index.htm']);195  send(file);196} else if (typeof opts.single === 'string') {197  file = find([opts.single]);198  send(file);199} else {200  // next() or 404201}202```203 204#### opts.ignores205Type: `false` or `Array<String | RegExp>`206 207Specify paths/patterns that should ignore the fallback behavior that `opts.single` provides.208 209By default, any asset-like path (URLs that end with an extension) will be ignored. This means that, for example, if `/foobar.jpg` is not found, a `404` response is sent instead of the `index.html` fallback.210 211Additionally, any `/.well-known/*` pathname ignores the fallback – as do all other dotfile requests when `opts.dotfiles` is enabled.212 213Any string value(s) will be passed through `new RegExp(value, 'i')` directly.214 215Finally, you may set `ignores: false` to disable ***all*** ignores, including the defaults. Put differently, this will fallback ***all*** unknown pathnames to your `index.html` (or custom `opts.single` value).216 217> **Important:** Only has an effect if `opts.single` is enabled.218 219#### opts.onNoMatch220Type: `Function`221 222A custom function to run if a file cannot be found for a given request. <br>By default, `sirv` will send a basic `(404) Not found` response.223 224The function receives the current `req <IncomingMessage>, res <ServerResponse>` pair for as its two arguments.225 226> **Note:** This won't run if a `next` callback has been provided to the middleware; see [`sirv`](#sirvdir-opts) description.227 228#### opts.setHeaders229Type: `Function`230 231A custom function to append or change any headers on the outgoing response. There is no default.232 233Its signature is `(res, pathname, stats)`, where `res` is the `ServerResponse`, `pathname` is incoming request path (stripped of queries), and `stats` is the file's result from [`fs.statSync`](https://nodejs.org/api/fs.html#fs_fs_statsync_path).234 235 236## License237 238MIT © [Luke Edwards](https://lukeed.com)239 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai