Page MenuHomeSealhub

image.ts
No OneTemporary

image.ts

import _locreq from "locreq";
import { JDDContext } from "..";
import { File as FileArgument } from "./file";
const locreq = _locreq(__dirname);
let example_image_promises: Record<string, Promise<string> | null> = {
"image1.jpg": null,
"image3.jpg": null,
"image4.jpg": null,
"image5.jpg": null,
};
export class Image extends FileArgument {
getTypeName() {
return "image";
}
async getExampleValue(context: JDDContext) {
const keys = Object.keys(example_image_promises);
const key = keys[Math.floor(Math.random() * keys.length)];
if (!example_image_promises[key]) {
example_image_promises[key] = context.encode_file(
{
type: "path",
path: locreq.resolve(`resources/${key}`),
},
true
);
}
return example_image_promises[key] as Promise<string>;
}
}

File Metadata

Mime Type
text/x-java
Expires
Fri, Jan 24, 15:16 (17 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601381
Default Alt Text
image.ts (797 B)

Event Timeline