@@ -138,7 +138,7 @@ For example, if we wished to upper-case everything in text content:
138138import {Transform } from ' stream' ;
139139
140140const server = http .createServer ((req , res ) => {
141- const s = new statik.Server (__dirname + ' /../fixtures ' , {
141+ const s = new statik.Server (__dirname + ' /public ' , {
142142 transform (fileString , pathname , req , res ) {
143143 return new Transform ({
144144 transform (chunk , _enc , cb ) {
@@ -155,7 +155,7 @@ const server = http.createServer((req, res) => {
155155### Serving custom directory
156156
157157``` js
158- const fileServer = new statik.Server (__dirname + ' /../ public' , {
158+ const fileServer = new statik.Server (__dirname + ' /public' , {
159159 directoryCallback (pathname , req , res ) {
160160 res .writeHead (200 , {
161161 ' Content-Type' : ' text/html'
@@ -256,6 +256,24 @@ Passing `true` will enable this check for all files.
256256Passing a RegExp instance will only enable this check if the content-type of
257257the respond would match that RegExp using its test() method.
258258
259+ For cases where a gzip file is older than the source file, you can
260+ listen for warnings about this.
261+
262+ ``` js
263+ const gzipFileServer = new statik.Server (__dirname + ' /public' , {
264+ gzip: true
265+ });
266+ gzipFileServer .on (
267+ ' warn' ,
268+ (warning , file , statMtime , gzStatMtime ) => {
269+ if (warning === ' Gzipped version is older than source file' ) {
270+ // One could append an extension and create the gzip file here
271+ console .log (file);
272+ }
273+ }
274+ );
275+ ```
276+
259277#### ` indexFile ` (Default: ` index.html ` )
260278
261279Choose a custom index file when serving up directories.
0 commit comments