title: Node.js, parse filename from URL
body: <p>How can I parse a url?</p>
  
  <pre><code>site.com:8080/someFile.txt?attr=100
  </code></pre>
  
  <p>or</p>
  
  <pre><code>site.com:8080/someFile.txt/?attr=100
  </code></pre>
  
  <p>I need to get <code>someFile.txt</code>, where is a file name I set by myself as the format (txt or some other).</p>
  
  <p><em>UPDATE</em></p>
  
  <p>I tried </p>
  
  <pre><code>var path = url.parse(req.url).path;
  </code></pre>
  
  <p>But I still cannot get the path (<code>someFile.txt</code>).</p>