zelin-bot / node_shims /sharp.js
Z User
v5.8.6: fix greeting spam on restart - 30min grace, channel verification, file fallback
9ef0e78
raw
history blame contribute delete
876 Bytes
// Sharp stub for HF Spaces — provides enough API surface for yt-publisher.js
// to not crash. Thumbnail generation will silently fail (no-op).
function sharpStub(input) {
return {
png: () => sharpStub(),
jpeg: (opts) => sharpStub(),
toBuffer: async () => Buffer.alloc(0),
toFile: async () => {},
composite: (layers) => sharpStub(),
resize: (w, h, opts) => sharpStub(),
metadata: async () => ({ width: 1280, height: 720, format: 'png' }),
raw: () => sharpStub(),
extend: (opts) => sharpStub(),
flatten: (opts) => sharpStub(),
grayscale: () => sharpStub(),
modulate: (opts) => sharpStub(),
};
}
sharpStub.cache = () => sharpStub;
sharpStub.concurrency = () => 1;
sharpStub.simd = () => sharpStub;
sharpStub.format = { jpeg: true, png: true, webp: true };
sharpStub.versions = { vips: 'stub' };
export default sharpStub;