GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - coderaiser/node-writejson: write stringified object to file

BranchesTags
Open more actions menu

Latest commit

 

History

49 Commits
49 Commits

Folders and files

NameName
Last commit message
Last commit date
lib
lib
 
 
test
test
 
 
.eslintrc.json
.eslintrc.json
 
 
.gitignore
.gitignore
 
 
.jscsrc
.jscsrc
 
 
.jshintrc
.jshintrc
 
 
.madrun.js
.madrun.js
 
 
.npmignore
.npmignore
 
 
.travis.yml
.travis.yml
 
 
ChangeLog
ChangeLog
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package.json
package.json
 
 

Repository files navigation

writejson License NPM version Dependency Status Build Status Coverage Status

Write stringified object to file.

Install

npm i writejson --save

How to use?

To handle formating optional argument options could be used according to JSON.stringify.

API

writejson(name, object[, options], callback)

Asynchonouse write stringified object.

const writejson = require('writejson');

const [error] = await tryToCatch(writejson, 'data.json', {hello: 'world'});

if (error)
    console.error(error.message);

const options = {
    replacer: ['hello'],    // properties to put in json
    space: 4,               // default space count
    eof: true,              // default new line at end of file
    encoding: 'utf8',       // default
    mode: '0o666',          // default
    flag: 'w',              // default
};

await writejson('data.json', {hello: 'world'}, options);

writejson.sync(name, object[, options])

Synchonouse write stringified object.

try {
    writejson.sync('data.json', {hello: 'world'});
} catch(error) {
    console.log(error.message);
}

writejson.sync.try(name, object[, options])

Synchonouse try to write stringified object.

writejson.sync.try('data.json', {hello: 'world'});

License

MIT

About

write stringified object to file

Topics

cloudcmdjavascriptjsonnodejswritefilewritefilesync

Resources

Readme
MIT license
Activity

Stars

4 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.