21 lines
431 B
JavaScript
21 lines
431 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
/**
|
|
Return a JSON representation of a file
|
|
|
|
@param {File} file
|
|
@return {Object}
|
|
*/
|
|
function encodeFileToJson(file) {
|
|
const filePath = file.getPath();
|
|
if (!filePath) {
|
|
return undefined;
|
|
}
|
|
return {
|
|
path: filePath,
|
|
mtime: file.getMTime(),
|
|
type: file.getType()
|
|
};
|
|
}
|
|
exports.default = encodeFileToJson;
|