You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
689 B

export const IMAGES = {
moshell: 'ghcr.io/moshell-lang/moshell:master',
};
/**
* Prepares a buffer to be sent to the runner.
*
* @param jobId The job unique identifier.
* @param code The code to be executed.
* @param image The image to be used.
*/
export function allocateBuffer(jobId: string, code: string, image: string): Buffer {
let cur = 0;
const buffer = Buffer.allocUnsafe(jobId.length + image.length + code.length + 9);
cur = buffer.writeUInt8(0, cur);
cur += buffer.write(jobId, cur);
cur = buffer.writeUInt32BE(image.length, cur);
cur = buffer.writeUInt32BE(code.length, cur);
cur += buffer.write(image, cur);
buffer.write(code, cur);
return buffer;
}