1.2.0 • Published 2 years ago

@teclone/node-utils v1.2.0

Weekly downloads
41
License
MIT
Repository
github
Last release
2 years ago

Node-Utils

Build Status Coverage Status semantic-release npm version npm

Node-Utils is a collection of day-to-day utility methods usable in node environments.

Installation

npm install @teclone/node-utils

getClosesetPackageDir(startPath: string = process.cwd())

This function returns the absolute path of the closest directory that contains a package.json file.

It will return startPath if startPath contains a package.json file as well.

import { getClosestPackageDir } from '@teclone/node-utils';

console.log(getClosestPackageDir());

mkdirSync(path: string)

Recursively creates the path given. If path points to a file, only the directories will be created.

import { mkdirSync } from '@teclone/node-utils';

mkdirSync('/projects/examples/test.ts');

// the directory path /projects/examples will be created