fileUrl.js 308 B

12345678910111213
  1. var normalizePath = require('./normalizePath');
  2. exports = function(path) {
  3. path = normalizePath(path);
  4. if (path[0] !== '/') {
  5. path = '/'.concat(path);
  6. }
  7. return encodeURI('file://'.concat(path)).replace(
  8. /[?#]/g,
  9. encodeURIComponent
  10. );
  11. };
  12. module.exports = exports;