Guides
Tutorials
Pop Tags

File Module

var file = require("file");

The file module lets you read files from your design files. It exports 3 methods:

file.exists(path) - Checks if a file exists (true/false)

file.read(path) - Reads the contents of a file (string)

file.join(path_segments*) - Takes a list of path segments and joins them with “/”

Here we require the file module and use it to read a template:

var file = require("file");

var index = file.read("/templates/index.tpl");
Continue to HTTP Module »