20251224
This commit is contained in:
parent
1259ba76c9
commit
6454e1b46b
19 changed files with 667 additions and 611 deletions
|
|
@ -16,7 +16,7 @@ export const storageController = {
|
|||
},
|
||||
loadFromGCS: async(folder: string, filename: string): Promise<string | null> => {
|
||||
const file = bucket.file(`${folder}/${filename}`);
|
||||
// console.log("loading file:", file.name);
|
||||
console.log("loading file:", `${folder}/${filename}`);
|
||||
try {
|
||||
const [data] = await file.download();
|
||||
return zlib.gunzipSync(data).toString("utf-8");
|
||||
|
|
@ -46,15 +46,20 @@ export const storageController = {
|
|||
},
|
||||
getFileList: async(): Promise<string[] | null> => {
|
||||
try {
|
||||
const files = await bucket.getFiles({
|
||||
const results = await bucket.getFiles({
|
||||
prefix: 'request_log/',
|
||||
});
|
||||
const list = [];
|
||||
for(const f of files[0]) {
|
||||
// console.log(f.name)
|
||||
list.push(f.name);
|
||||
}
|
||||
return list;
|
||||
const files = results[0];
|
||||
files.sort((a, b) => {
|
||||
if(!a.metadata.timeCreated || !b.metadata.timeCreated) return 0;
|
||||
const timeA = new Date(a.metadata.timeCreated).getTime();
|
||||
const timeB = new Date(b.metadata.timeCreated).getTime();
|
||||
return timeA - timeB;
|
||||
});
|
||||
// for(const f of files[0]) {
|
||||
// list.push(f.name);
|
||||
// }
|
||||
return files.map((f) => f.name);
|
||||
} catch(error) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue