normalize-file-to-url-path

1.0.0 • Public • Published

normalize-file-to-url-path

experimental

A simple function to normalize a file path into a URL path that can be used when testing req.url from an HTTP server.

var toUrl = require('normalize-file-to-url-path')
 
toUrl('./foo.js')
//=> 'foo.js'
 
toUrl('foo bar.js')
//=> 'foo%20bar.js'
 
toUrl('/')
//=> null

Experimental -- mostly used internally across some of my tools.

License

MIT, see LICENSE.md for details.

Package Sidebar

Install

npm i normalize-file-to-url-path

Weekly Downloads

19

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mattdesl