How to use the fileURLToPath function from url
Find comprehensive JavaScript url.fileURLToPath code examples handpicked from public code repositorys.
11 12 13 14 15 16 17 18 19 20const path = require('path') const url = require('url') app.whenReady().then(() => { protocol.registerFileProtocol('atom', (request, callback) => { const filePath = url.fileURLToPath('file://' + request.url.slice('atom://'.length)) callback(filePath) }) }) ```
+ 15 other calls in file
GitHub: Mimi124/Pos
196 197 198 199 200 201 202 203 204 205endColumn: to && to.column } if (fromUrl.protocol === 'file:') { if (fileURLToPath) { result.file = fileURLToPath(fromUrl) } else { /* c8 ignore next 2 */ throw new Error(`file: protocol is not available in this PostCSS build`) }
GitHub: Mermade/api-registry
291 292 293 294 295 296 297 298 299 300} } } else if (u.startsWith('file')) { ng.logger.prepend('L'); const filename = url.fileURLToPath(u); s = fs.readFileSync(filename,'utf8'); response.status = 200; response.ok = true; }
11 12 13 14 15 16 17 18 19 20 21 22//----------------------------------------------------------------------------- // Helpers //----------------------------------------------------------------------------- const __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('module-importer.cjs', document.baseURI).href))); const __dirname$1 = path.dirname(__filename$1); const require$1 = module$1.createRequire(__dirname$1 + "/"); const { ModuleImporter } = require$1("./module-importer.cjs");
