function getFileUri(file) {
  if (!isAbsolute(file)) {
    throw new Error('Path must be absolute to compute file uri. Received: ' + file);
  }

  const fileUrl = process.platform === 'win32' ? new URL(`file:///${file}`) : new URL(`file://${file}`);

  return fileUrl.href;
}
Get file uri considering OS
@param {string} file Absolute filepath
@returns {string} file uri