Skip to content

jsonfileΒ #253

@outslept

Description

@outslept

https://www.npmjs.com/package/jsonfile

https://github.com/jprichardson/node-jsonfile

jsonfile is legacy syntactic sugar.

Bare minimum, that should be more than enough for most of the peeps:

import { readFile, writeFile } from 'node:fs/promises'

const readJson  = f => readFile(f, 'utf8').then(JSON.parse)
const writeJson = (f, x) => writeFile(f, JSON.stringify(x, null, 2) + '\n')

The options are not hard to replace as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions