# easy-renamer

> Easily rename files using custom rename functions that are automatically used against any filepaths that match the associated regex or glob patterns.

Latest version **0.3.1** (published 2016-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install easy-renamer
pnpm add easy-renamer
yarn add easy-renamer
bun add easy-renamer
```

## 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.3.1 |
| Published | 2016-04-03 |
| First published | 2015-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert, doowb |
| Keywords | base, basename, dir, directory, dirname, ext, extension, extname, file, filename, filepath, name, parse, path, rename, renamer, renaming |

## Links

- npm: https://www.npmjs.com/package/easy-renamer
- Repository: https://github.com/jonschlinkert/easy-renamer
- Issues: https://github.com/jonschlinkert/easy-renamer/issues
- npm.io page: https://npm.io/package/easy-renamer

## Dependencies (5)

- [vinyl](https://npm.io/package/vinyl.md) ^1.1.1
- [kind-of](https://npm.io/package/kind-of.md) ^3.0.2
- [lazy-cache](https://npm.io/package/lazy-cache.md) ^1.0.3
- [micromatch](https://npm.io/package/micromatch.md) ^2.3.7
- [extend-shallow](https://npm.io/package/extend-shallow.md) ^2.0.1

## 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.3.1 (latest) — 2016-04-03
- 0.3.0 — 2015-12-03
- 0.2.1 — 2015-11-02
- 0.2.0 — 2015-08-07
- 0.1.1 — 2015-07-30
- 0.1.0 — 2015-07-30

## README

# easy-renamer [![NPM version](https://img.shields.io/npm/v/easy-renamer.svg?style=flat)](https://www.npmjs.com/package/easy-renamer) [![NPM downloads](https://img.shields.io/npm/dm/easy-renamer.svg?style=flat)](https://npmjs.org/package/easy-renamer) [![Build Status](https://img.shields.io/travis/jonschlinkert/easy-renamer.svg?style=flat)](https://travis-ci.org/jonschlinkert/easy-renamer)

> Easily rename files using custom rename functions that are automatically used against any filepaths that match the associated regex or glob patterns.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install easy-renamer --save
```

## Examples

See [examples](example.js). To run the examples, git clone the project then run the following from the root of the project:

```sh
$ npm i && node example
```

## Usage

```js
var Renamer = require('easy-renamer');
var renamer = new Renamer({destBase: 'foo/bar'});

renamer.matcher('*.md', function(file) {
  return path.join(file.dirname, file.filename + '.html');
});

renamer.rename('a/b/c.md');
//=> 'a/b/c.html'
```

**Example with multiple patterns**

```js
var Renamer = require('easy-renamer');
var renamer = new Renamer();

function extname(ext) {
  return function(file) {
    return path.join(file.dirname, file.filename + ext);
  };
}

// use glob patterns...
renamer.matcher('**/*.md', extname('.html'));

// or regex
renamer.matcher(/foo\/.*\.less$/, extname('.css'));

glob('**/*', function(err, files) {
  files.forEach(function(fp) {
    fp = renamer.rename(fp);
    //=> do something with fp...
  });
});
```

## Changelog

**v0.3.0**

* Renamed `.match()` method to `.matcher()` (this is the last time, I promise!)
* `file.name` property was renamed to `file.filename`

**v0.2.0**

* Renamed `.pattern()` method to `.match()`
* Implements lazy-caching

## Related projects

You might also be interested in these projects:

* [map-files](https://www.npmjs.com/package/map-files): Return an object for a glob of files. Pass a `rename` function for the keys,… [more](https://www.npmjs.com/package/map-files) | [homepage](https://github.com/jonschlinkert/map-files)
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://www.npmjs.com/package/micromatch) | [homepage](https://github.com/jonschlinkert/micromatch)
* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Pollyfill for node.js `path.parse`, parses a filepath into an object. | [homepage](https://github.com/jonschlinkert/parse-filepath)

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/easy-renamer/issues/new).

## Building docs

Generate readme and API documentation with [verb](https://github.com/verbose/verb):

```sh
$ npm install verb && npm run docs
```

Or, if [verb](https://github.com/verbose/verb) is installed globally:

```sh
$ verb
```

## Running tests

Install dev dependencies:

```sh
$ npm install -d && npm test
```

## Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/easy-renamer/blob/master/LICENSE).

***

_This file was generated by [verb](https://github.com/verbose/verb), v, on April 02, 2016._

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