OptimalBits/cabinet là dự án mã nguồn mở trên GitHub với 56 sao, viết chủ yếu bằng JavaScript. A lightweight fast static file server for node loaded with useful features
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
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.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/OptimalBits/cabinet là nguồn chính thức.
OptimalBits/cabinet có bao nhiêu sao?
OptimalBits/cabinet có 56 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/OptimalBits/cabinet. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
OptimalBits/cabinet có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho OptimalBits/cabinet. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
OptimalBits/cabinet có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho OptimalBits/cabinet. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
OptimalBits/cabinet còn đang phát triển không?
Commit gần nhất trên OptimalBits/cabinet là 4.0 năm trước (theo timestamp GitHub). Repo có 7 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
OptimalBits/cabinet viết bằng ngôn ngữ gì?
OptimalBits/cabinet chủ yếu viết bằng JavaScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc cabinet có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về cabinet.