JSFiddle - React, Tailwind, and code Playground

HTML

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
    <path id='mypath' class="line" d="M25,267.3333333333333L40.991154889938684,261.8831846694442L57.15803675668989,255.2703865261117L73.33224058080827,250.82884545479965L89.14034653656726,247.01447492287184L105.13150142650595,241.42128736403544L121.29838329325715,233.99060015472227L137.47258711737555,230.25691823020065L153.45642004994704,221.4691953508747L169.44757493988573,218.96051319333762L185.61445680663692,214.84172655165025L201.78866063075532,213.54704116917856L217.5967665865143,208.5516828379424L233.58792147645298,208.40864394299507L24...77.09893838138115L747.0621477226161,74.64893884741213L763.2290295893673,67.99579640037655L779.4032334134856,62.98209974927536L795.2113393692447,57.73000493992862L811.2024942591834,51.770050983791435L827.3693761259347,45.905456290952486L843.543579950053,43.008001752276584L859.3516859058119,36.08711983521144L875.3428407957506,30.233528134291475L891.5097226625019,24.44595438488568L907.6839264866202,18.676718955344967L923.6677594191917,14.741315512307892L939.6589143091304,6.474400917149012L955.8257961758816,5">
</svg>
<div id='log'></div>

JavaScript

var c = document.getElementsByTagName("path");
var rec = c[0].getBoundingClientRect();

var totalLength = rec.width;





$('#log').html("width: " + rec.width);