path-rite

toSvgPath

Convert structured path data back to an SVG path d-attribute string.

toSvgPath(pathData: PathData): string

pathData — A PathData object with an elements array of path commands.

Returns — An SVG path d-attribute string.

// Round-trip: parse, modify, serialize
const data = pathRite.parsePath("M 0 0 L 100 0 L 100 100 Z");
data.elements[1].x = 200; // widen the shape
const svg = pathRite.toSvgPath(data);