unjs/ufo

Splice filename from URL

beyer-johannes opened this issue · 2 comments

Describe the feature

It whould be a great help if parseURL also strip filenames like http://foo.com/foo/bar.png?test=123#token into { protocol: 'http:', auth: '', host: 'foo.com', pathname: '/foo', search: '?test=123', hash: '#token', filename: 'bar.png' }.

I think its a great feature because files are also a part of url.

Additional information

  • Would you be willing to help implement this feature?
pi0 commented

We could expose a new util getFilename(url) to do this 👍🏼

Should be great too