npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fnet/chrome-profiles

v0.1.8

Published

## Introduction

Downloads

6

Readme

@fnet/chrome-profiles

Introduction

The @fnet/chrome-profiles tool is designed to help users easily retrieve the names of user profiles from their Google Chrome browser. This can be particularly useful for developers or anyone who needs to manage or access different user profiles on a Chrome installation.

How It Works

This tool reads the 'Local State' file within the Google Chrome user data directory. It extracts and returns an array of profile names associated with the Chrome browser. By default, it automatically determines the correct file path based on the operating system being used, ensuring a seamless experience.

Key Features

  • Automatic Path Detection: The tool automatically locates the Chrome user data directory based on the operating system (Windows, macOS, or Linux).
  • Profile Retrieval: It efficiently reads the 'Local State' file and extracts the names of all the user profiles available in the Chrome installation.
  • Easy Integration: With an asynchronous function, it easily integrates into other applications or workflows that require access to Chrome profile information.

Conclusion

The @fnet/chrome-profiles tool is a straightforward utility for extracting user profile names from the Chrome browser, tailored for those who need quick access to this information without delving into Chrome's user data manually.

Developer Guide for the @fnet/chrome-profiles Library

Overview

The @fnet/chrome-profiles library provides a straightforward way to extract information about user profiles from the Chrome browser. Primarily, it reads the 'Local State' file of the Chrome browser to gather and return a list of user profile names along with their corresponding directory paths. This can be particularly useful for applications needing to interface directly with user-specific Chrome settings or data.

Installation

To install the @fnet/chrome-profiles library, you can use either npm or yarn:

Using npm:

npm install @fnet/chrome-profiles

Using yarn:

yarn add @fnet/chrome-profiles

Usage

This library is designed to be simple and minimalistic. Here's how you can use it to retrieve Chrome user profiles:

import getChromeProfiles from '@fnet/chrome-profiles';

(async () => {
  try {
    const profiles = await getChromeProfiles({ 
      // Optional: You can specify a custom path to Chrome's user data directory.
      // chromeDataPath: '/path/to/custom/chrome/user/data'
    });

    console.log('Chrome User Profiles:', profiles);
  } catch (error) {
    console.error('Error fetching profiles:', error);
  }
})();

Parameters

  • chromeDataPath (optional): A string to specify the path to Chrome's user data directory. If not provided, the library defaults to the standard user data directories based on the current operating system:
    • Windows: %LOCALAPPDATA%\Google\Chrome\User Data
    • macOS: ~/Library/Application Support/Google/Chrome
    • Linux: ~/.config/google-chrome

Examples

Here’s how you might use this library for a typical use case where you want to display all Chrome user profiles:

import getChromeProfiles from '@fnet/chrome-profiles';

(async () => {
  try {
    const profiles = await getChromeProfiles();
    profiles.forEach(profile => {
      console.log(`Profile Name: ${profile.name}, Directory: ${profile.dir}`);
    });
  } catch (error) {
    console.error('Error fetching profiles:', error);
  }
})();

In this example, the code fetches the profiles and logs each profile’s name and directory to the console.

Acknowledgement

This library internally utilizes Node.js built-in modules such as fs for file system operations and path for handling file paths. Acknowledging the efforts of contributors and maintainers of Node.js, which provides these essential modules that enable this library to function effectively.

Input Schema

$schema: https://json-schema.org/draft/2020-12/schema
type: object
properties:
  chromeDataPath:
    type: string
    description: Optional. The path to Chrome's user data directory. If not
      provided, defaults to the standard path based on the current operating
      system.
  mode:
    type: string
    description: "Optional. Operation mode: 'default' to list profiles, or 'open' to
      launch a profile."
  profile:
    type: string
    description: Optional. The profile name to launch in 'open' mode.
required: []