find-up-json

Find, read and parse the first matching file found walking the filesystem upwards.

MIT 8 个版本
安装
npm install find-up-json
yarn add find-up-json
pnpm add find-up-json
bun add find-up-json
README

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.

Install

npm install find-up-json

Usage

import findUp from 'find-up-json';

// Let's find the nearest `package.json` file

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..."
//     // ...
//   }
// }

License

MIT © Fabio Spampinato

版本列表
2.0.5 2025-01-12
2.0.4 2024-03-12
2.0.3 2024-03-04
2.0.2 2023-02-20
2.0.1 2023-01-13
2.0.0 2022-04-07
1.0.1 2021-07-12
1.0.0 2021-05-12