summaryrefslogtreecommitdiffstats
path: root/lib/json/encodeFile.js
blob: d2c9e8a7d3b6cb0031a207b795d0b3568fe09f52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

/**
    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;