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 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-system-path-db-es6

v1.0.1

Published

SystemPathDB is a library for Node.js with focus on objectifying the specified path location.

Readme

Node-SystemPathDB

SystemPathDB is a library for Node.js with focus on objectifying the specified path location.

How to use:

Instantiating an object:

const databaseName = new SystemPathDB('/home/user');
or
const databaseName = new SystemPathDB('C:\\Users\\PatrykSitko');

Monitoring the structure of an instanced object:

After instantiation you need to start monitoring the directory. The monitor function accepts an optional attribute named interval. The interval attribute describes at what intevals the database system has to refresh the cashed structure. The default value is 100 (milliseconds).

databaseName.monitor();
or
databaseName.monitor(25);

To stop monitoring an instance; You have to call the stopMonitoring function of that instance. (You can start and stop monitoring an instance as many times as you need.)

databaseName.stopMonitoring();

Updating the structure of an instanced object:

If you want to update the structure without the use of the monitor function. You have to call the update function for the targeted instance.

databaseName.update();

This will update the structure once, while or while-not monitoring it.


Accessing the (monitored) structure:

To acces the structure stored inside of the instance you start by calling an variable attached to the instance of the database called structure:

const databaseStructure = databaseName.structure;

the structure variable is a get (syntax) function that returns an javascript object notation of underlying folders and files. Files have their extention separator replaced with an underscore if one was present; A file named text-file.txt will become text-file_txt inside of the json structure.


3 basic functions to extend functionality of the structure:

The SystemPathDB library has 3 basic functions called:

  • addStructureFunction
  • addDirFunction
  • addFileFunction

Those functions are accessible from within the SystemPathDB instance, and are used for adding functionality to the database structure.

>>> Functionality of; addStructureFunction:

The addStructureFunction is used to add functions to the structure variable that can be accessed via the SystemPathDB instance (as mentioned above) and is a function that can be invoked from the instance itself (databaseName.addStructureFunction("funcName",console.log);).

This function has the following 2 parameters:

  1. function name.

    Is used to name the anonimous function (declared in the second parameter); This function name can be used to call the added anonimous function described by attributing this parameter.

  2. anonimous function.

    The anonimous function of addStructureFunction recieves 3 arguments by default wrapped into an object from the SystemPathDB instance. Those arguments are as follow:

    • path (typeof string)

    The path argument by default returns an string with a forward slash. As the structure variable accessed via the SystemPathDB instance is the root path of the structure.

    • getDatabaseStructure (typeof function)

    The getDatabaseStructure function returns the database structure variable. This function is made available to render easier access to the database structure from within the anonimous function.

    • extention (typeof string)

    The extention argument by default returns null. (The root path has no extention.)

>>> Functionality of; addDirFunction & addFileFunction:

The addDirFunction and addFileFunction is used to add functions to variables of type directory (or file respectively) located inside of the json structure. Those directory (or file) type variables can be located within the structure variable. The structure variable is accessible via the SystemPathDB instance (as mentioned above) and those functions can be invoked from the instance itself (Ex.:databaseName.addFileFunction("funcName",console.log,(currentPath)=>true);).

This function has the following 3 parameters:

  1. function name.

    Is used to name the anonimous function (declared in the second parameter); This function name can be used to call the added anonimous function described by attributing this parameter.

  2. anonimous function.

    The anonimous function of addDirFunction recieves 5 arguments by default wrapped into an object from the SystemPathDB instance. Those arguments are as follow:

    • key (typeof string)

      The key argument of the anonimous function defines the current directory or file name inside of the json structure. (Ex.: databaseName.addDirFunction("consoleLogKey",({key})=>{console.log(key);}); Usecases: databaseName.structure.downloads.consoleLogKey(); logs "downloads" to the console in this case. databaseName.structure.downloads.documents.consoleLogKey(); logs "documents" to the console in this case. )

    • path (typeof string)

      The path argument of the anonimous function defines the current path inside of the json structure (including the key argument). (Ex.: databaseName.addDirFunction("consoleLogPath",({path})=>{console.log(path);}); Usecases: databaseName.structure.downloads.consoleLogPath(); logs "/downloads" to the console in this case. databaseName.structure.downloads.documents.consoleLogPath(); logs "/downloads/documents" to the console in this case. )

    • isHidden (typeof boolean)

      The isHidden argument of the anonimous function defines whether the file is hidden or not inside of the system structure. (Ex.: databaseName.addDirFunction("consoleLogIsHidden",({isHidden})=>{console.log(isHidden);},"*"); Usecases: databaseName.structure.downloads.consoleLogIsHidden(); logs "false" to the console in this case. databaseName.structure.downloads.documents.consoleLogIsHidden(); logs "false" to the console in this case. )

    • extention (typeof string)

      The extention argument of the anonimous function returns the file extension (Ex.: "txt") or is undefined if it's an directory.

    • getDatabaseStructure (typeof function)

      The getDatabaseStructure function returns the database structure variable. This function is made available to render easier access to the database structure from within the anonimous function.

  3. (optional) target function.

    Is used to target specific pathways inside of the structure. This function will recieve the current path as parameter to use to determine if the specific function has to be added to the current pathway. By default, all structure paths are targeted. Example: Path to database structure: /home/user System structure paths starting from the path to database structure: /documents/file.pdf & /downoads/documents/ect... The target to add the specific function to: documents By adding a function to a specific target. The function will be invocable only trough the targeted pathway inside of the structure; Example: databaseName.addDirFunction("consoleLogAttributes",console.log,(pathway)=>pathway.endsWith("documents")); valid invocations: databaseName.structure.documents.consoleLogAttributes(); databaseName.structure.downloads.documents.consoleLogAttributes(); invalid invocations: databaseName.structure.documents.file_pdf.consoleLogAttributes(); (it's not the target.) databaseName.structure.downloads.consoleLogAttributes(); (it's not the target.)


Predefined structure functions:

  • list
  • getAbsolutePath
  • includes
  • new

Predefined directory functions:

  • getAbsolutePath
  • isDirectory
  • isFile
  • list
  • includes
  • new
  • delete

Predefined file functions:

  • getAbsolutePath
  • isDirectory
  • isFile
  • read
  • write
  • delete