title: Remove filename.extension in url using nodejs
body: <p>I'm a beginner in nodejs, so please excuse if this question already answered. I tried multiple methods but didn't work for me.</p>
  
  <p>I'm trying to remove the filename.extension in http url</p>
  
  <p>For example:</p>
  
  <p><a href="http://somedomain.com/path1/path2/path3/myfile.txt" rel="nofollow noreferrer">http://somedomain.com/path1/path2/path3/myfile.txt</a></p>
  
  <p>to </p>
  
  <p><a href="http://somedomain.com/path1/path2/path3/" rel="nofollow noreferrer">http://somedomain.com/path1/path2/path3/</a></p>
  
  <p>The filename in the url is dynamic, so I cannot use "myfile.txt" explicitly in the code.</p>
  
  <p>I'm not using any web frameworks, But I have <a href="http://stringjs.com" rel="nofollow noreferrer">http://stringjs.com</a> library</p>