# filelet

> A simple file-helper library

Latest version **0.1.3** (published 2015-04-21) · 0 weekly downloads

## Install

```sh
npm install filelet
pnpm add filelet
yarn add filelet
bun add filelet
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2015-04-21 |
| First published | 2014-11-26 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.4 |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | YC |
| Maintainers | yc |
| Keywords | file |

## Links

- npm: https://www.npmjs.com/package/filelet
- Repository: https://github.com/yinso/filelet
- Issues: https://github.com/yinso/filelet/issues
- npm.io page: https://npm.io/package/filelet

## Dependencies (7)

- [ncp](https://npm.io/package/ncp.md) =1.0.1
- [glob](https://npm.io/package/glob.md) =4.2.1
- [vinyl](https://npm.io/package/vinyl.md) =0.4.5
- [loglet](https://npm.io/package/loglet.md) >=0.1.2
- [mkdirp](https://npm.io/package/mkdirp.md) =0.5.0
- [funclet](https://npm.io/package/funclet.md) >=0.1.1
- [underscore](https://npm.io/package/underscore.md) =1.7.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.1.3 (latest) — 2015-04-21
- 0.1.2 — 2014-11-29
- 0.1.1 — 2014-11-28
- 0.1.0 — 2014-11-26

## README

# Filelet - a simple vinyl-based file-helper library

## Install 

    npm install filelet

## Usage 

    var filelet = require('filelet');
    // see API


### `loadFiles(source, [transform,] callback)`

Load a list of files based on the `source` and apply `transform` if supplied. Callback should follow the signature of `function (err, files)`. The `files` returned are a list of [`vinyl`](https://www.npmjs.org/package/vinyl) file objects.

Source can be an array of file paths, or a glob as expected by the [`glob`](https://www.npmjs.org/package/glob) module.

`transform` is a helper function with the signature of `function(file, next)`, where `file` is a `vinyl` object and `next` should take in `error` and `file`.

    // silly example.
    filelet.loadFiles('./*.js', function(file, next) { next(null, file); }, function (err, files) {
      ...
    })

### `loadFile(filePath, [transform, ] callback)`

Singular form of `loadFiles`. It only expects a `filePath` (not a `glob`, since `glob` can map to more than one files).


### `copy(srcPath, destPath, callback)`

Copies files from `srcPath` to `destPath`. Will create intermediate directories if they don't exist.

Symlinks are automatically dereferenced - i.e. it will duplicate the content rather than the link.

### `move(srcPath, destPath, callback)`

Wrapper over `mkdirp` and `fs.rename` so you can move file to a previously nonexistent directory.

### `mkdirp(filePath, cb)`

Wrapper around [`mkdirp`](https://www.npmjs.org/package/mkdirp) module.

### `writeFile(filePath, content, [options, ] callback)`

Wrapping around `mkdirp` and `fs.writeFile`, so the intermediate non-existent directoreis are created prior to write.

### `readdirRSync(dirPath)`

### `cache()`

A file cache to cache the loaded files until the file is modified.

    var cache = filelet.cache()
    cache.loadFile('/path/to/file', [function(file, next) { /* transform */ }, ]function(err, file) { ... });
    cache.loadFiles(['/array/of/path/to/file', ...], [function (file, next) { /* transform */ } , ]function (err, files) { ... })

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