You can use the Google Drive API
Sample From Google Drive API Reference Page.
/**
* Print a file's metadata.
*
* @param {String} fileId ID of the file to print metadata for.
*/
function printFile(fileId) {
var request = gapi.client.drive.files.get({
'fileId': fileId
});
request.execute(function(resp) {
console.log('Title: ' + resp.title);
console.log('Description: ' + resp.description);
console.log('MIME type: ' + resp.mimeType);
});
}
/**
* Download a file's content.
*
* @param {File} file Drive File instance.
* @param {Function} callback Function to call when the request is complete.
*/
function downloadFile(file, callback) {
if (file.downloadUrl) {
var accessToken = gapi.auth.getToken().access_token;
var xhr = new XMLHttpRequest();
xhr.open('GET', file.downloadUrl);
xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken);
xhr.onload = function() {
callback(xhr.responseText);
};
xhr.onerror = function() {
callback(null);
};
xhr.send();
} else {
callback(null);
}
}
Or you can use a Google Apps Script to create a rest api that returns file information. Using the Execution API
Sample Code:
function GetFiles() {
var result = [];
var files = DriveApp.getFiles();
while (files.hasNext()) {
var file = files.next();
var fileInfo = new Object();
fileInfo.id = file.getId();
fileInfo.name = file.getName();
fileInfo.size = file.getSize();
fileInfo.url = file.getDownloadUrl();
result.push(fileInfo);
}
return result;
}
The above code returns a list of Objects that contain the file's id, name, size, and the download url.
Hope that helps.