@d-mok/quasar-app-extension-quasar-axe 2.1.52 → 2.1.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -93,12 +93,40 @@ export class SupbaseBucket extends Map<string, string> {
|
|
|
93
93
|
this.delete(path)
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
async
|
|
96
|
+
async downloadOne(path: string, filename: string) {
|
|
97
|
+
let url = this.get(path) ?? ''
|
|
98
|
+
if (url === '') throw 'url not found'
|
|
99
|
+
downloadFile(url, filename)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async downloadMany(
|
|
103
|
+
paths: string[],
|
|
104
|
+
filenames: string[],
|
|
105
|
+
zipName: string = this.bucketName
|
|
106
|
+
) {
|
|
107
|
+
let urls = paths.map($ => this.get($) ?? '')
|
|
108
|
+
let zip = await zipCreate(Object.fromEntries(filenames.zip(urls)))
|
|
109
|
+
await zipDownload(zipName, zip)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async downloadAll(zipName: string = this.bucketName) {
|
|
97
113
|
let zip = await zipCreate(Object.fromEntries(this))
|
|
98
|
-
await zipDownload(
|
|
114
|
+
await zipDownload(zipName, zip)
|
|
99
115
|
}
|
|
100
116
|
|
|
101
117
|
reactive(): this {
|
|
102
118
|
return reactive(this) as this
|
|
103
119
|
}
|
|
104
120
|
}
|
|
121
|
+
|
|
122
|
+
function downloadFile(url: string, filename: string) {
|
|
123
|
+
// Create a link element
|
|
124
|
+
const link = document.createElement('a')
|
|
125
|
+
link.href = url
|
|
126
|
+
link.download = filename
|
|
127
|
+
|
|
128
|
+
// Simulate a click event on the link element
|
|
129
|
+
document.body.appendChild(link)
|
|
130
|
+
link.click()
|
|
131
|
+
document.body.removeChild(link)
|
|
132
|
+
}
|