Files
gitbook/lib/json/encodeFile.js
T
2016-04-25 11:05:06 +02:00

22 lines
362 B
JavaScript

/**
Return a JSON representation of a file
@param {File} file
@return {Object}
*/
function encodeFileToJson(file) {
var filePath = file.getPath();
if (!filePath) {
return undefined;
}
return {
path: filePath,
mtime: file.getMTime(),
type: file.getType()
};
}
module.exports = encodeFileToJson;