I've been trying to get a list of all files in a specific folder of my storage bucket and it works pretty well but there is no information about the meta of the object as described in this document: https://cloud.google.com/storage/docs/json_api/v1/objects#resource
The shape of the item object is not the same and instead gives a "ReferenceCompat" for each item in the array.
Instead - the only provided properties are bucket, fullPath and name.
Does anyone know why this is?
https://firebase.google.com/docs/storage/web/list-files
const storageRef = firebase.storage().ref(folder);
const listFiles = function listFilesAndSaveToSlice() {
storageRef
.listAll()
.then((res) => {
res.items.forEach((item) => {
let {name, id, owner, acl, ...etc} = item;
// {name: name, id: undefined, ...undefined}
});
})
.catch((error) => {
});
};
This is the object provided instead of what's expected:
ReferenceCompat: {
"_delegate": {
"_service": {
"app": {
"name": "[DEFAULT]",
"automaticDataCollectionEnabled": false,
"options": {
"apiKey": "xxxxxxx-xxxxxxxxx",
"authDomain": "xxxxxx",
"projectId": "xxxx",
"storageBucket": "xxxxxx",
"messagingSenderId": "xxxxxxxxx",
"appId": "xxxxxxxx"
}
},
"_authProvider": {
"name": "auth-internal",
"container": {
"name": "[DEFAULT]",
"providers": {}
},
"component": {
"name": "auth-internal",
"multipleInstances": false,
"instantiationMode": "LAZY",
"type": "PRIVATE"
},
"instances": {},
"instancesDeferred": {},
"onInitCallbacks": {}
},
"_appCheckProvider": {
"name": "app-check-internal",
"container": {
"name": "[DEFAULT]",
"providers": {}
},
"component": null,
"instances": {},
"instancesDeferred": {},
"onInitCallbacks": {}
},
"_pool": {},
"_firebaseVersion": "8.6.5",
"_bucket": {
"bucket": "xxxxx",
"path_": ""
},
"_host": "firebasestorage.googleapis.com",
"_appId": null,
"_deleted": false,
"_maxOperationRetryTime": 120000,
"_maxUploadRetryTime": 600000,
"_requests": {}
},
"_location": {
"bucket": "xxxxxxxxxx",
"path_": "samples/coming to an end v2.mp3.asd"
}
},
"storage": {
"app": {
"name": "[DEFAULT]",
"automaticDataCollectionEnabled": false,
"options": {
"apiKey": "xxxxxx",
"authDomain": "xxxxxx",
"projectId": "xxxxx",
"storageBucket": "xxxxx",
"messagingSenderId": "xxxxx",
"appId": "xxxx"
}
},
"_delegate": {
"app": {
"name": "[DEFAULT]",
"automaticDataCollectionEnabled": false,
"options": {
"apiKey": "xxxxxxxxxxxxxx",
"authDomain": "xxxxxxx",
"projectId": "xxxxxx",
"storageBucket": "xxxxx",
"messagingSenderId": "xxxxx",
"appId": "xxxxxx"
}
},
"_authProvider": {
"name": "auth-internal",
"container": {
"name": "[DEFAULT]",
"providers": {}
},
"component": {
"name": "auth-internal",
"multipleInstances": false,
"instantiationMode": "LAZY",
"type": "PRIVATE"
},
"instances": {},
"instancesDeferred": {},
"onInitCallbacks": {}
},
"_appCheckProvider": {
"name": "app-check-internal",
"container": {
"name": "[DEFAULT]",
"providers": {}
},
"component": null,
"instances": {},
"instancesDeferred": {},
"onInitCallbacks": {}
},
"_pool": {},
"_firebaseVersion": "8.6.5",
"_bucket": {
"bucket": "megatech-ltd.appspot.com",
"path_": ""
},
"_host": "firebasestorage.googleapis.com",
"_appId": null,
"_deleted": false,
"_maxOperationRetryTime": 120000,
"_maxUploadRetryTime": 600000,
"_requests": {}
},
"INTERNAL": {}
}
}