Spaces:
Running
Running
Download tiled-mcp/src/sharp.ts from 4math/tiled-map-builder: direct link, hf CLI and curl.
- Browser
- Download file 588 Bytes
-
https://huggingface.co/spaces/4math/tiled-map-builder/resolve/main/tiled-mcp/src/sharp.ts
- Command line
-
hf download hf://spaces/4math/tiled-map-builder/tiled-mcp/src/sharp.ts
-
curl -L -o sharp.ts https://huggingface.co/spaces/4math/tiled-map-builder/resolve/main/tiled-mcp/src/sharp.ts
588 Bytes
| // sharp is loaded lazily so the map tools keep working even if the native image library | |
| // fails to install: only sprite generation and preview rendering need it. | |
| export type Sharp = (typeof import("sharp"))["default"]; | |
| export async function loadSharp(): Promise<Sharp> { | |
| try { | |
| return (await import("sharp")).default; | |
| } catch (err) { | |
| throw new Error( | |
| `The 'sharp' image library could not be loaded (${err instanceof Error ? err.message : String(err)}). Run 'npm install' in the repository; sprite generation and previews need it, map editing does not.`, | |
| ); | |
| } | |
| } | |