npm

@fnet/edge-profiles

0.1.6 • Public • Published

@fnet/edge-profiles

Introduction

The @fnet/edge-profiles project is a simple utility designed to help users easily retrieve the names of user profiles from the Microsoft Edge browser. By accessing and reading the 'Local State' file within Edge's user data directory, this utility simplifies the task of identifying different user profiles set up in the browser. This can be particularly useful for users who need to manage or differentiate between multiple profiles on a single system.

How It Works

The tool operates by locating the Edge browser's user data directory either through a specified path or by using the default path based on the operating system. It then reads the 'Local State' file found within this directory and extracts the names of the profiles listed within the browser. The utility returns these profile names, providing an insight into the various user profiles configured in Edge.

Key Features

  • Platform-Aware: Automatically determines the standard user data path for Edge, depending on whether you're using Windows, macOS, or Linux.
  • Profile Listing: Reads the necessary configuration file and lists all the user profile names associated with the Edge browser installation.
  • Error Handling: Provides feedback if it fails to read the profiles, helping users diagnose issues related to path or permission errors.

Conclusion

@fnet/edge-profiles is a straightforward utility for users who need to identify and work with multiple user profiles in Microsoft Edge. By automating the process of reading and listing these profiles, it simplifies the task, making it hassle-free to manage user data configurations.

Developer Guide for @fnet/edge-profiles

Overview

The @fnet/edge-profiles library provides a straightforward way to access and enumerate user profiles from the Edge browser. This library focuses on extracting profile information such as profile names and directory paths from the browser's local data. It is useful for developers who need to programmatically interact with or manage Edge browser profiles.

Installation

To install the @fnet/edge-profiles library, you can use either npm or yarn. Run one of the following commands in your project's root directory:

Using npm:

npm install @fnet/edge-profiles

Using yarn:

yarn add @fnet/edge-profiles

Usage

Below is a guide on how to use the @fnet/edge-profiles library to list Edge browser user profiles. The core function provided by this library is the default export, which allows you to retrieve browser profile information.

List Edge Browser Profiles

You can use the default function from the library to get a list of Edge browser profiles. It returns a promise that resolves to an array of objects, each containing the name and directory of a profile.

import edgeProfiles from '@fnet/edge-profiles';

// Calling the function without arguments to use the default path
edgeProfiles()
  .then(profiles => {
    profiles.forEach(profile => {
      console.log(`Profile Name: ${profile.name}, Profile Directory: ${profile.dir}`);
    });
  })
  .catch(err => {
    console.error('Error retrieving profiles:', err.message);
  });

If you want to specify a custom path to the Edge user data directory, you can pass an object with an edgeDataPath property:

import edgeProfiles from '@fnet/edge-profiles';

const customPath = '/path/to/custom/edge/user/data';

edgeProfiles({ edgeDataPath: customPath })
  .then(profiles => {
    profiles.forEach(profile => {
      console.log(`Profile Name: ${profile.name}, Profile Directory: ${profile.dir}`);
    });
  })
  .catch(err => {
    console.error('Error retrieving profiles:', err.message);
  });

Examples

Here are some scenarios where this library can be particularly useful:

Example 1: List Default Profiles

This example shows how to list all the user profiles stored in the default Edge user data directory.

import edgeProfiles from '@fnet/edge-profiles';

edgeProfiles().then(profiles => {
  console.log('Edge Profiles:', profiles);
}).catch(console.error);

Example 2: List Profiles from a Custom Path

Sometimes the user data may not be located in the default directory. In such cases, you can specify the path to the data.

import edgeProfiles from '@fnet/edge-profiles';

edgeProfiles({ edgeDataPath: '/custom-path' })
  .then(profiles => {
    console.log('Custom Path Edge Profiles:', profiles);
  })
  .catch(console.error);

Acknowledgement

This project appreciates the effort and contributions of developers and contributors of the libraries and tools that @fnet/edge-profiles depends on. Their work has been instrumental in making this library functional and reliable.

Input Schema

$schema: https://json-schema.org/draft/2020-12/schema
type: object
properties:
  edgeDataPath:
    type: string
    description: Optional. The path to the Edge's user data directory. Defaults to
      the standard path on the current operating system if not provided.
required: []

Readme

Keywords

none

Package Sidebar

Install

npm i @fnet/edge-profiles

Weekly Downloads

4

Version

0.1.6

License

MIT

Unpacked Size

13.1 kB

Total Files

5

Last publish

Collaborators

  • serdark
  • serdar986
  • gboyraz