# @qiwi/uniconfig-plugin-api-file

> Uniconfig file API (fs) plugin

Latest version **4.0.1** (published 2024-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @qiwi/uniconfig-plugin-api-file
pnpm add @qiwi/uniconfig-plugin-api-file
yarn add @qiwi/uniconfig-plugin-api-file
bun add @qiwi/uniconfig-plugin-api-file
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2024-04-18 |
| First published | 2018-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 16.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Qiwi |
| Maintainers | antongolub, qiwibot |
| Keywords | universal config, unified config |

## Links

- npm: https://www.npmjs.com/package/@qiwi/uniconfig-plugin-api-file
- Repository: https://github.com/qiwi/uniconfig
- Homepage: https://github.com/qiwi/uniconfig#readme
- Issues: https://github.com/qiwi/uniconfig/issues
- npm.io page: https://npm.io/package/@qiwi/uniconfig-plugin-api-file

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.6.2
- [@qiwi/uniconfig-core](https://npm.io/package/@qiwi/uniconfig-core.md) 3.5.5

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2024-04-18
- 4.0.0 — 2023-09-18
- 3.6.0 — 2023-09-13
- 3.5.5 — 2022-08-09
- 3.5.4 — 2022-07-27
- 3.5.3 — 2021-11-13
- 3.5.2 — 2021-09-24
- 3.5.1 — 2020-07-25
- 3.3.1 — 2020-05-04
- 3.3.0 — 2020-01-29
- 3.2.2 — 2019-12-29
- 3.2.1 — 2019-11-02
- 3.0.1 — 2019-06-23
- 3.0.0 — 2019-06-22
- 2.22.2 — 2019-05-29
- … 10 more at https://npm.io/package/@qiwi/uniconfig-plugin-api-file/versions

## README

# @qiwi/uniconfig-plugin-api-file

Uniconfig File API plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-api-file
  yarn add @qiwi/uniconfig-plugin-api-file
```

## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigFileApiPlugin from '@qiwi/uniconfig-plugin-api-file'
import uniconfigJsonParserPlugin from '@qiwi/uniconfig-plugin-parser-json'
    
rollupPlugin(uniconfigFileApiPlugin)
rollupPlugin(uniconfigJsonParserPlugin)

const target = './foo.json'
/** foo.json content:
{
  "foo": "bar"
}
*/

const config = uniconfig({
  data: {
    someParam: '$fromFile:foo'
  },
  source: {
    fromFile: {
      data: '<some path>',
      pipeline: 'file>json'
    }
  }
}, {
  mode: 'sync',
  pipeline: 'datatree'
})    

config.get('someParam') // "bar"

const missingTarget = './foo-missing.json' // this file does not exist
const target2 = './foo2.json'
/** foo2.json content:
 {
  "foo2": "bar2"
}
 */

const config = uniconfig({
  data: {
    someParam: '$fromFile:foo'
  },
  source: {
    fromFile: {
      data: [missingTarget, target2, target], // in this mode the content of the first existing file is returned
      pipeline: 'file>json'
    }
  }
}, {
  mode: 'sync',
  pipeline: 'datatree'
})

config.get('someParam') // "bar2"
```

---
_Source: https://npm.io/package/@qiwi/uniconfig-plugin-api-file · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
