add var fs = require('fs'); because fs was not defined