$ gnpm install find-up-json
Find, read and parse the first matching file found walking the filesystem upwards.
Compared to alternatives this library is tiny, it has no dependencies, and it can be bundled without problems.
npm install --save find-up-json
import findUp from 'find-up-json';
const pkg = findUp ( 'package.json' );
// =>
// {
// path: '/path/to/found/package.json',
// buffer: BufferContentOfFile,
// content: {
// // Result of JSON-parsing the content of the file
// "name": "something..."
// // ...
// }
// }
MIT © Fabio Spampinato
Copyright 2013 - present © cnpmjs.org | Home |