Sveltekit Files endpoint

How to list files with sveltekit

import { json } from "@sveltejs/kit"

export const GET = ()=>{
	const files = import.meta.glob("../../../static/*")

	return json({
		images: Object.keys(files).map(key => key.split('/').pop())
	})
}

// returns {"images":["file1.png","file2.png"]}