@jfonx/file-utils
Allows you to perform specific operations on files
Last updated 6 years ago by justkey .
MIT · Original npm · Tarball · package.json
$ cnpm install @jfonx/file-utils 
SYNC missed versions from official npm registry.

file-utils

Allows you to perform specific operations on files

Installation

npm install @jfonx/file-utils

Usage

import { findUpJsonFile, toObject, writeFile } from '@jfonx/file-utils';

/* Write a file on the disk */
writeFile({
  file: __dirname + '/filename.txt',
  content: 'I am programmer',
  force: true, // Force rewrite if the file exists
});

/* Read the contents of a JSON file and convert it to an object */
toObject(__dirname + '/tsconfig.json', true /* exit program if error */);

/* Looks for a json file recursively back and stops as soon as the file is found or the root of the hard drive is reached*/
const module = findUpJsonFile({
  filename: 'package.json' /* The desired JSON file */,
  isJson: true,
  rootDir: __dirname /* From this folder */,
});
console.log(module);

Current Tags

  • 3.0.1                                ...           latest (5 years ago)

6 Versions

  • 3.0.1                                ...           5 years ago
  • 3.0.0                                ...           5 years ago
  • 2.0.2                                ...           6 years ago
  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |