mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
22 lines
362 B
JavaScript
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;
|