mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 05:43:46 +01:00
26 lines
553 B
JavaScript
26 lines
553 B
JavaScript
class websiteFile{
|
|
constructor(file){
|
|
this.file=file
|
|
}
|
|
|
|
async getViewerURL(){
|
|
var params=new URLSearchParams()
|
|
var urlbase="/view"
|
|
switch (trueTypeOf(this.file)) {
|
|
case String.name:
|
|
params.append("file",this.file)
|
|
break
|
|
case File.name:
|
|
var base64=btoa(await getTextFromUploadedFileAsync(this.file))
|
|
params.append("fileBase64",base64);
|
|
break
|
|
}
|
|
if ([...params].length>0){
|
|
return urlbase+"?"+params.toString()
|
|
}
|
|
else{
|
|
return urlbase
|
|
}
|
|
|
|
}
|
|
} |