OptimalBits/cabinet is one of the open-source repositories TopGit tracks, currently at 56 stars, written primarily in JavaScript. A lightweight fast static file server for node loaded with useful features
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
It is possible to define virtual files in cabinet. A virtual file is the result of some processing. For example, an application manifest file is a virtual file that is generated
on the fly with the given files and with an always and up-to-date timestamp (the timestamp is re-generated when any of the files in the manifest changes).
Virtual files are also cached as normal files and therefore they are served very fast.
Example of a file server for serving an application cache manifest:
The timestamp (#465398.1347735807000) will be automatically updated if foo.txt or bar.txt changes,
so that the browser will invalidate its application cache when needed.
A virtual is just an asynchronous function without parameters with the following callback signature:
function(err, data, files)
Arguments
err {Error} Some error object describing an error.
data {String|Buffer} The data that is going to be served when the virtual file is accessed.
files {Array} Array of files to listen for changes. This is used when enabling the cache. If any
of the files changes, the cache will invalidate the entry containing the virtual.
Example of a (very) dummy virtual:
function dummy(name){
return function(cb){
cb(null, 'My name is '+name, []);
}
}
Directory Watcher
Cabinet includes a directory watcher that is used to keep the cache always fresh as well as to compute new ETAG values for files and virtual files based on their dependencies. So files depending on other files will automatically get new ETAGS based on all their dependencies.
In some platforms such as Mac OSX, there is a known error due to limits in the amount of allowed open files:
Error: watch EMFILE
To avoid this error use ulimit, for example to allow 4096 open files:
ulimit -n 4096
Typescript
Cabinet support on-the-fly compilation and optimization of typescript source files. The file watcher will listen for changes in the source files and their dependencies, therefore always delivering
the latest code. Compilation is expensive, so in a production server the cache should be enabled
for optimal performance.
Reference
cabinet(root, [options, virtuals])
Arguments
root {String} Path to the root directory for the served files.
options {Object} options object (see options)
virtuals {Object} Object mapping paths to virtuals.
##Options
Most options are directly inherited from connect's options. Besides those we have the options related
to the provided filters:
ignore Specifies an array of files or directories to ignore, supports fnmatch syntax.
files Specifies an object mapping file paths to actual files. Useful to specify standalone files instead of whole directories.
cache Enables caching. Accepts an object with the parameters: maxSize (per object in bytes) and maxObjects.
maxAge Browser cache maxAge in milliseconds. defaults to 0
hidden Allow transfer of hidden files. defaults to false
redirect Redirect to trailing "/" when the pathname is a dir
gzip Enables gzip compression if the browser supports it (only affect ascii files).
minjs Enables UglifyJS javascript minification.
less Enables LESS CSS compilation. Accepts an object with options to the less compilation, as for example paths, which specifies paths where to find included files.
coffee Enables coffee script compilation of .coffee files.
typescript Enables typescript compilation of .ts files. Accepted parameters are:
target , target version of the produced javascript (ES3 (default) or ES5)
module, module system to use for the generated javascript (commonjs or amd (default))
concatenate, boolean describing if the compiled code should be concatenated with its dependencies or not (default true)
out, boolean describing if the flag "out" shall be used when compiling (this treats internal modules specially, check ts doc for details)
keepComments, boolean describing if the compiled code should keep comments (default false)
##Roadmap
Deflate compression filter.
##License
(The MIT License)
Copyright (c) 2012 Optimal Bits Sweden AB [email protected]
Copyright (c) 2011 TJ Holowaychuk
Copyright (c) 2010 Sencha Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No homepage URL was recorded for OptimalBits/cabinet in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Does OptimalBits/cabinet have any tags?
TopGit's last sync did not record any GitHub topics for OptimalBits/cabinet. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on OptimalBits/cabinet?
The most recent commit recorded on OptimalBits/cabinet was 3.7 years ago, based on the GitHub push timestamp. The repository has 7 forks — one of the better signals of community interest.
How many stars does OptimalBits/cabinet have?
OptimalBits/cabinet has 56 GitHub stars — refresh the page for the live number, or check github.com/OptimalBits/cabinet. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is OptimalBits/cabinet written in?
OptimalBits/cabinet is written primarily in JavaScript. GitHub's language field is based on the largest share of bytes in the default branch.
Where do I read more about OptimalBits/cabinet?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/OptimalBits/cabinet is the definitive source.
Read full README in the tab above.
Is cabinet worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of cabinet.