# @mdxvac/fs-utils

> Caching file system access

Latest version **0.0.4** (published 2022-10-11) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @mdxvac/fs-utils
pnpm add @mdxvac/fs-utils
yarn add @mdxvac/fs-utils
bun add @mdxvac/fs-utils
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2022-10-11 |
| First published | 2022-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | christian@hackyourshack.org |
| Maintainers | shackhacker-christian |
| Keywords | utilities, cache, filesystem, typescript |

## Links

- npm: https://www.npmjs.com/package/@mdxvac/fs-utils
- Repository: https://github.com/mdxvac/mdxvac.git#main
- Homepage: https://mdxvac.netlify.app/
- Issues: https://github.com/mdxvac/mdxvac/issues
- npm.io page: https://npm.io/package/@mdxvac/fs-utils

## Dependencies (1)

- [@mdxvac/mem-cache](https://npm.io/package/@mdxvac/mem-cache.md) 0.0.4

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2022-10-11
- 0.0.3 — 2022-09-23
- 0.0.2 — 2022-09-22
- 0.0.1 — 2022-09-20

## README

# @mdxvac/fs-utils

> **DEPRECATED:** Please consider using the plugin [astro-m2dx](https://www.npmjs.com/package/astro-m2dx), which bundles all features from the `@mdxvac` plugins in one plugin (completely opt-in).

Some utilities to work with the file system, e.g. to find files in parent folders.

## Content

- [Content](#content)
- [What is this?](#what-is-this)
- [When should I use this?](#when-should-i-use-this)
- [Install](#install)
- [Use](#use)

## What is this?

An NPM package with a few utilities to work with configuration files in the file system. It also provides a cached variant, if you work in a static context, e.g. with a Static Site Generator (SSG).

## When should I use this?

You shouldn't, it is meant for internal use in the @mdxvac plugins, but not tested for general purpose.

If you work with configuration files placed in the file system relative to your subject file, you usually want to find the closest or all files looking up the directory tree. Then you can use the functions `findUp` (finding the closest) and `findUpAll` (finding all, up to a stop directory).

## Install

This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
In Node.js (version 12.20+, 14.14+, or 16.0+), install with `npm`:

```sh
npm install -D @mdxvac/fs-utils
```

## Use

Example usages:

```js
const file = "src/pages/docs/install/my-content.mdx";

if (await exists(file)) {
  const howToRender = await findUp("how-to-render.json", file);

  const yaml = await findUpAll("_frontmatter.yaml", file);
  const frontmatter = deepMerge(yaml.map(c => loadYAML(c)));

  ...
}
```

---
_Source: https://npm.io/package/@mdxvac/fs-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
