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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nodejsacorepathfinder

v1.0.0

Published

The **ACore JS PathFinder** provides a set of classes and utilities for working with file paths, directories, and operating systems in TypeScript projects.

Readme

ACore JS PathFinder

The ACore JS PathFinder provides a set of classes and utilities for working with file paths, directories, and operating systems in TypeScript projects.

Table of Contents

Introduction

The File System Utility Library simplifies file and directory management tasks by offering a unified interface for different operating systems. It includes classes for exploring directories, listing files, retrieving file stats, and more.

Installation

To install the File System Utility Library, you can use npm:

npm install nodejsacorepathfinder

Usage

Exploring Directories

import { ExploredDirectory } from 'file-system-utility';

const dir = new ExploredDirectory('/path/to/directory');
const fileList = dir.allRecursive();

console.log('Files and directories:', fileList.get());

Retrieving File Stats

import { FilesUtil } from 'file-system-utility';

const fileStats = FilesUtil.getFileStats('/path/to/file.txt');
if (fileStats) {
    console.log('File Path:', fileStats.filePath);
    console.log('File Size:', fileStats.fileSize);
    console.log('Is File:', fileStats.isFile);
    console.log('Is Folder:', fileStats.isFolder);
}

Resolving Operating System

import { PathFinderAPI } from 'file-system-utility';

const pathFinder = PathFinderAPI.resolveCurrent();
if (pathFinder) {
    if (pathFinder.acFolderExist()) {
        console.log('ACORE_FOLDER exists.');
    } else {
        pathFinder.createAcFolder();
        console.log('ACORE_FOLDER created.');
    }
} else {
    console.error('Unsupported operating system.');
}

Certainly! Here's an improved "API Documentation" section for your README.md that provides more detailed information about each class and interface:

API Documentation

The File System Utility Library provides a comprehensive set of classes and interfaces to simplify working with file paths, directories, and operating systems.

Classes

ExploredDirectory

Represents an explored directory, providing methods to retrieve information about its contents.

Constructor
const directory: string = "/path/to/directory";
new ExploredDirectory(directory);
Methods
  • allRecursive(): FileList: Returns a list of all files and directories in the directory and its subdirectories.
  • list(): FileList: Returns a list of files and directories in the directory.
  • sub(directory: string): ExploredDirectory: Returns a new instance of ExploredDirectory representing a subdirectory.
  • getFile(file: string): string: Returns the contents of a specified file.
  • subs(): FileList: Returns a list of subdirectories in the directory.
  • files(): FileList: Returns a list of files in the directory.
  • get(): string: Returns the path of the explored directory.

FilesUtil

Provides utility methods for working with files and directories.

Methods
  • listRecursive(directory: string): string[]: Returns a list of all files and directories in the directory and its subdirectories.
  • get(root: string, file: string): string: Returns the full path of a file.
  • dir(root: string, dir: string): string: Returns the full path of a subdirectory.
  • list(directory: string): string[]: Returns a list of files and directories in the directory.
  • listRecursiveWithNames(directory: string, filenames: string[]): string[]: Returns a list of files with specific filenames in the directory and its subdirectories.

PathFinderAPI

Utility class for resolving and interacting with path finders based on the current operating system.

Methods
  • resolveCurrent(): IPathFinder | null: Resolves the appropriate path finder based on the current operating system.
  • createAcFolder(): void: Creates the ACORE_FOLDER directory if it doesn't exist.

Interfaces

IStats

Represents the statistics of a file or directory.

Properties
  • filePath: string: The path of the file or directory.
  • fileSize: number: The size of the file in bytes.
  • isFolder: boolean: Indicates whether the entry is a folder (directory).
  • isFile: boolean: Indicates whether the entry is a file.

IPathFinder

Represents a utility for finding paths on different operating systems.

Methods
  • acFolderExist(): boolean: Checks if the ACORE_FOLDER directory exists.
  • exist(relativePath: string): boolean: Checks if a file or directory exists at the specified relative path.
  • isFolder(relativeFolderPath: string): boolean: Checks if a specified relative path points to a directory.
  • isFile(relativeFilePath: string): boolean: Checks if a specified relative path points to a file.
  • getFileStats(relativeFilePath: string): IStats | null: Retrieves statistics of a file or directory.
  • find(): string: Finds the base path.
  • findFile(relativePath: string): string: Finds the full path to a file.

APathFinder

Abstract class providing base functionality for path finding on different operating systems.

Methods
  • acFolderExist(): boolean: Checks if the ACORE_FOLDER directory exists.
  • exist(relativePath: string): boolean: Checks if a file or directory exists at the specified relative path.
  • isFolder(relativeFolderPath: string): boolean: Checks if a specified relative path points to a directory.
  • isFile(relativeFilePath: string): boolean: Checks if a specified relative path points to a file.
  • getFileStats(relativeFilePath: string): IStats | null: Retrieves statistics of a file or directory.

Operating System Implementations

WindowsPathFinder, LinuxPathFinder, MacosPathFinder

Provides methods to resolve paths and interact with the specific operating system.