mirror of
https://github.com/JonnyBro/JaBa.git
synced 2025-01-01 16:23:02 +05:00
11 lines
309 B
JavaScript
11 lines
309 B
JavaScript
import path from "node:path";
|
|
|
|
/**
|
|
* Convert a local file path to a file URL.
|
|
* @param {string} filePath - local file's path.
|
|
* @returns {string} file URL
|
|
*/
|
|
export const toFileURL = filePath => {
|
|
const resolvedPath = path.resolve(filePath);
|
|
return "file://" + resolvedPath.replace(/\\\\|\\/g, "/");
|
|
};
|