Socket
Book a DemoInstallSign in
Socket

@mdaemon/ini-file-cache

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mdaemon/ini-file-cache

A library for reading, writing, and watching ini files for changes

1.1.2
latest
Source
npmnpm
Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

Dynamic JSON Badge Static Badge install size Dynamic JSON Badge Node.js CI

@mdaemon/ini-file-cache, A library for reading, writing, and watching ini files for changes

Not applicable to a browser context.

Install

$ npm install @mdaemon/ini-file-cache --save

Node CommonJS

   const IniFileCache = require("@mdaemon/ini-file-cache");

Node Modules

   import IniFileCache from "@mdaemon/ini-file-cache";

IniFileCache

// Create a new IniFileCache instance
const iniCache = new IniFileCache("/path/to/file/", "config.ini");

// Read a value from the ini file
const value = iniCache.getSetting("section", "key", "defaultValue");
console.log(value);

// Write a value to the ini file
iniCache.setSetting("section", "key", "new value");

// Save changes to the file
iniCache.save();

// Watch for changes in the ini file
iniCache.watch();

// Stop watching the file
iniCache.unwatch();

// Get all sections
const sections = iniCache.getSections();
console.log(sections);

// Get all keys in a section
const keys = iniCache.getKeys("section");
console.log(keys);

// Check if a section exists
const sectionExists = iniCache.hasSection("section");
console.log(sectionExists);

// Check if a key exists in a section
const keyExists = iniCache.hasKey("section", "key");
console.log(keyExists);

// Remove a key from a section
iniCache.removeKey("section", "key");

// Remove an entire section
iniCache.removeSection("section");

// Reload the file from disk
iniCache.reload();

iniCahe.listener.on("change", (filename) => { });

iniCache.listener.on("error", (error) => { });

iniCache.listener.on("reload", (filePath) => { });

iniCache.listener.on("save", (filePath) => { });

License

Published under the LGPL-2.1 license.

Published by
MDaemon Technologies, Ltd.
Simple Secure Email

https://www.mdaemon.com

Keywords

ini

FAQs

Package last updated on 24 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.