summaryrefslogtreecommitdiffstats
path: root/node_modules/file-uri-to-path/index.js
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-18 23:26:45 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-18 23:26:45 +0100
commit81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 (patch)
tree8b959d50c5a614cbf9fcb346ed556140374d4b6d /node_modules/file-uri-to-path/index.js
parent1870f3fdf43707a15fda0f609a021f516f45eb63 (diff)
downloadwebsite_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.gz
website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.bz2
website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.zip
rm node_modules
Diffstat (limited to 'node_modules/file-uri-to-path/index.js')
-rw-r--r--node_modules/file-uri-to-path/index.js66
1 files changed, 0 insertions, 66 deletions
diff --git a/node_modules/file-uri-to-path/index.js b/node_modules/file-uri-to-path/index.js
deleted file mode 100644
index 48cb280..0000000
--- a/node_modules/file-uri-to-path/index.js
+++ /dev/null
@@ -1,66 +0,0 @@
-
-/**
- * Module dependencies.
- */
-
-var sep = require('path').sep || '/';
-
-/**
- * Module exports.
- */
-
-module.exports = fileUriToPath;
-
-/**
- * File URI to Path function.
- *
- * @param {String} uri
- * @return {String} path
- * @api public
- */
-
-function fileUriToPath (uri) {
- if ('string' != typeof uri ||
- uri.length <= 7 ||
- 'file://' != uri.substring(0, 7)) {
- throw new TypeError('must pass in a file:// URI to convert to a file path');
- }
-
- var rest = decodeURI(uri.substring(7));
- var firstSlash = rest.indexOf('/');
- var host = rest.substring(0, firstSlash);
- var path = rest.substring(firstSlash + 1);
-
- // 2. Scheme Definition
- // As a special case, <host> can be the string "localhost" or the empty
- // string; this is interpreted as "the machine from which the URL is
- // being interpreted".
- if ('localhost' == host) host = '';
-
- if (host) {
- host = sep + sep + host;
- }
-
- // 3.2 Drives, drive letters, mount points, file system root
- // Drive letters are mapped into the top of a file URI in various ways,
- // depending on the implementation; some applications substitute
- // vertical bar ("|") for the colon after the drive letter, yielding
- // "file:///c|/tmp/test.txt". In some cases, the colon is left
- // unchanged, as in "file:///c:/tmp/test.txt". In other cases, the
- // colon is simply omitted, as in "file:///c/tmp/test.txt".
- path = path.replace(/^(.+)\|/, '$1:');
-
- // for Windows, we need to invert the path separators from what a URI uses
- if (sep == '\\') {
- path = path.replace(/\//g, '\\');
- }
-
- if (/^.+\:/.test(path)) {
- // has Windows drive at beginning of path
- } else {
- // unix path…
- path = sep + path;
- }
-
- return host + path;
-}