@d-mok/quasar-app-extension-quasar-axe 2.1.56 → 2.1.57
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
|
@@ -95,29 +95,29 @@ export class SupbaseBucket extends Map<string, string> {
|
|
|
95
95
|
this.delete(path)
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
async
|
|
98
|
+
async save(path: string, filename: string): Promise<File> {
|
|
99
99
|
let url = this.get(path) ?? ''
|
|
100
100
|
if (url === '') throw 'url not found'
|
|
101
101
|
let file = await createFileObjectFromUrl(url, filename)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
file = renameFileObject(file, filename)
|
|
103
|
+
file = addExtToFileObject(file)
|
|
104
|
+
return file
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
async downloadMany(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
107
|
+
// async downloadMany(
|
|
108
|
+
// paths: string[],
|
|
109
|
+
// filenames: string[],
|
|
110
|
+
// zipName: string = this.bucketName
|
|
111
|
+
// ) {
|
|
112
|
+
// let urls = paths.map($ => this.get($) ?? '')
|
|
113
|
+
// let zip = await zipCreate(Object.fromEntries(filenames.zip(urls)))
|
|
114
|
+
// await zipDownload(zipName, zip)
|
|
115
|
+
// }
|
|
116
116
|
|
|
117
|
-
async downloadAll(zipName: string = this.bucketName) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
117
|
+
// async downloadAll(zipName: string = this.bucketName) {
|
|
118
|
+
// let zip = await zipCreate(Object.fromEntries(this))
|
|
119
|
+
// await zipDownload(zipName, zip)
|
|
120
|
+
// }
|
|
121
121
|
|
|
122
122
|
reactive(): this {
|
|
123
123
|
return reactive(this) as this
|
|
@@ -128,12 +128,18 @@ async function createFileObjectFromUrl(
|
|
|
128
128
|
url: string,
|
|
129
129
|
filename: string
|
|
130
130
|
): Promise<File> {
|
|
131
|
-
// Fetch the data from the URL
|
|
132
131
|
const response = await fetch(url)
|
|
133
132
|
const data = await response.blob()
|
|
134
133
|
const type = response.headers.get('content-type') ?? undefined
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
return new File([data], filename, { type })
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function renameFileObject(file: File, filename: string): File {
|
|
138
|
+
return new File([file], filename, { type: file.type })
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function addExtToFileObject(file: File): File {
|
|
142
|
+
let ext = mime.extension(file.type) || ''
|
|
143
|
+
if (file.name.endsWith(ext)) return file
|
|
144
|
+
return renameFileObject(file, `${file.name}.${ext}`)
|
|
139
145
|
}
|