10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 21:24:00 +01:00
QUESTDB_website/static/scripts/websiteFile.js

18 lines
415 B
JavaScript
Raw Normal View History

2019-09-30 09:53:07 +02:00
class websiteFile{
2019-10-02 19:20:37 +02:00
constructor(file){
this.file=file
2019-09-30 09:53:07 +02:00
}
2019-10-02 19:20:37 +02:00
async getViewerURL(){
var urlbase="/view"
switch (trueTypeOf(this.file)) {
case "string":
return String.raw`${urlbase}?file=${this.file}`
break
case "File":
var base64=btoa(await getTextFromUploadedFileAsync(this.file))
return String.raw`${urlbase}?fileBase64=${base64}`;
break
}
2019-09-30 09:53:07 +02:00
}
}