mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' of https://github.com/city-unit/SillyTavern into feature/exorcism
This commit is contained in:
@ -45,6 +45,17 @@ export function getSortableDelay() {
|
||||
return isMobile() ? 750 : 50;
|
||||
}
|
||||
|
||||
export async function bufferToBase64(buffer) {
|
||||
// use a FileReader to generate a base64 data URI:
|
||||
const base64url = await new Promise(resolve => {
|
||||
const reader = new FileReader()
|
||||
reader.onload = () => resolve(reader.result)
|
||||
reader.readAsDataURL(new Blob([buffer]))
|
||||
});
|
||||
// remove the `data:...;base64,` part from the start
|
||||
return base64url.slice(base64url.indexOf(',') + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rearranges an array in a random order.
|
||||
* @param {any[]} array The array to shuffle.
|
||||
|
Reference in New Issue
Block a user