mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add config, increase cache TTL, use async file reads
This commit is contained in:
@ -81,14 +81,14 @@ export const read = (image) => {
|
||||
* Parses a card image and returns the character metadata.
|
||||
* @param {string} cardUrl Path to the card image
|
||||
* @param {string} format File format
|
||||
* @returns {string} Character data
|
||||
* @returns {Promise<string>} Character data
|
||||
*/
|
||||
export const parse = (cardUrl, format) => {
|
||||
export const parse = async (cardUrl, format) => {
|
||||
let fileFormat = format === undefined ? 'png' : format;
|
||||
|
||||
switch (fileFormat) {
|
||||
case 'png': {
|
||||
const buffer = fs.readFileSync(cardUrl);
|
||||
const buffer = await fs.promises.readFile(cardUrl);
|
||||
return read(buffer);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user