Socket
Socket
Sign inDemoInstall

jsontxt

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jsontxt

Write, read, & delete JSON stored in a .txt file located in a project's root directory.


Version published
Weekly downloads
4
decreased by-42.86%
Maintainers
1
Install size
4.15 kB
Created
Weekly downloads
 

Readme

Source

jsontxt

Write, read, & delete JSON stored in a .txt file.

Installation

$ npm i jsontxt

Usage

Require module:

const jsontxt = require("jsontxt");

Write json:

const json = [{ key: "value" }, "item"];

jsontxt.write(json, { filename: "test" });

// Writes JSON in a test.txt file located in the project's root directory [default].

Read json:

const json = jsontxt.read({ filename: "test" });

console.log(json);

// [{ key: "value" }, "item"]

Delete file:

jsontxt.delete({ filename: "test" });

// Deletes test.txt file.

.txt Path

By default, PWD is the environment variable used to find a project's root directory. If it is null or undefined, or if you'd like to save the .txt file in a different location, you can define an absolute path to host the file using the JSONTXT_PATH environment variable name.

.txt Name

By default, the name assigned to the .txt file is "json". If you'd like to save the .txt file under a different name, you can define it using the JSONTXT_NAME environment variable name.

Keywords

FAQs

Last updated on 24 May 2023

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc