Limiter

RobeeeJay edited this page Aug 23, 2012 · 1 revision

This module limits the size of submitted or uploaded content.

new fw.Limiter({ max: "64k", onLimit: func });

max is a string specifying the size in kilobytes, megabytes or gigabytes, it accepts a number followed by the letters k, m or g, though kb, mb and gb also will work.

onLimit is an optional function that accepts three arguments, (handler, request, response), where handler is the Limiter object itself. onLimit is called to inform the client that the upload has been limited.

Simple Example

var stackFull = new fw.Stack();

stackFull.append(new fw.Limiter({ max: "10mb" }));

The above limits uploaded content to 10 megabyes.