CartoDB-SQL-API/app/models/formats/index.js

21 lines
497 B
JavaScript
Raw Normal View History

var fs = require("fs");
2015-05-13 19:00:01 +08:00
var formats = {};
2014-08-03 02:26:01 +08:00
function formatFilesWithPath(dir) {
var formatDir = __dirname + '/' + dir;
return fs.readdirSync(formatDir).map(function(formatFile) {
return formatDir + '/' + formatFile;
});
}
var formatFilesPaths = []
.concat(formatFilesWithPath('ogr'))
.concat(formatFilesWithPath('pg'));
formatFilesPaths.forEach(function(file) {
var format = require(file);
formats[format.prototype.id] = format;
2013-05-16 17:24:52 +08:00
});
module.exports = formats;