Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
// SPDX-License-Identifier: AGPL-3.0-only
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import bwipjs from "@bwip-js/node";
export async function generateQRCode(
text: string,
size: number,
color?: string
): Promise<string> {
const buffer = await bwipjs.toBuffer({
bcid: "qrcode",
text,
scale: 2,
height: size,
width: size,
...(color && { barcolor: color })
});
return `data:image/png;base64,${buffer.toString("base64")}`;
}
export async function generateQRCodeBuffer(
text: string,
size: number,
color?: string
): Promise<Buffer> {
const buffer = await bwipjs.toBuffer({
bcid: "qrcode",
text,
scale: 2,
height: size,
width: size,
...(color && { barcolor: color })
});
return buffer;
}
export function generateQRCodeSync(text: string, size: number): string {
// bwipjs.toBuffer returns a Promise, but when called without await
// in a synchronous context, we need to handle it differently
// For now, keeping the existing async implementation
throw new Error(
"Synchronous QR code generation not supported. Use async version or inline implementation."
);
}