Add postfile function
This commit is contained in:
@@ -42,8 +42,9 @@ export function checkNullish(data:any){
|
||||
return data === undefined || data === null
|
||||
}
|
||||
|
||||
const domSelect = true
|
||||
export async function selectSingleFile(ext:string[]){
|
||||
if(await !isTauri){
|
||||
if(domSelect){
|
||||
const v = await selectFileByDom(ext, 'single')
|
||||
const file = v[0]
|
||||
return {name: file.name,data:await readFileAsUint8Array(file)}
|
||||
@@ -375,4 +376,11 @@ export function getCurrentCharacter(){
|
||||
|
||||
export function toState<T>(t:T):Writable<T>{
|
||||
return writable(t)
|
||||
}
|
||||
|
||||
export function BufferToText(data:Uint8Array){
|
||||
if(!TextDecoder){
|
||||
return Buffer.from(data).toString('utf-8')
|
||||
}
|
||||
return new TextDecoder().decode(data)
|
||||
}
|
||||
Reference in New Issue
Block a user