Description |
This function returns the metadata information of the current File in a JSON object. The function is a JavaScript Promise. Below is a sample function that describes how to chain multiple functions in JavaScript Promise. |
var fileName = PanoramaAPI.fileName;
if (fileName != "") {
PanoramaAPI.getFilePropertiesJSON().then(function (data) {
if (data== null ) {
htm = "Error to retrive File Info"
$("#divIDToBindFileMetaData").html('<p class="api-error">' + htm + '</p>');
}
else {
var filePropJsonObj = JSON.parse(data);
var htm = "";
$.each(filePropJsonObj, function (i, item) {
i = i.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });
if (item == false || item == null) {
return false
} else {
htm += '<li><p>' + i + ":" + '<span>' + item + '</span></p></li>';
}
})
$("#divIDToBindFileMetaData")
.html('<ul>' + htm + '</ul>');
};
}).catch(function (error) {
console.log("Error Message:", error);
});
Syntax |
PanoramaAPI.getFilePropertiesJSON |
|
Parameters |
NA |
|
Returns |
FielMetaDataResult:JavaScriptObject |
{
"FielMetaDataResult": {
"creationTime": "3/6/2020 4:04:51 PM",
"lastAcesstime": "3/6/2020 4:04:51 PM",
"lastWritetime": "2/3/2020 10:32:01 AM",
"size": "0.1787 MB",
"fileName": "Penguins.jpg",
"fileDirectoryName": null,
"fileReadOnly": "False",
"errorStatus": false,
"errorType": null
}
} |
Post your comment on this topic.