# replace-file-by-list

> replace files by a user-defined replacement list

Latest version **1.0.2** (published 2022-11-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install replace-file-by-list
pnpm add replace-file-by-list
yarn add replace-file-by-list
bun add replace-file-by-list
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-11-24 |
| First published | 2022-11-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | fwg |
| Maintainers | adf0001 |
| Keywords | replace, file, config, list |

## Links

- npm: https://www.npmjs.com/package/replace-file-by-list
- Repository: https://github.com/adf0001/replace-file-by-list
- Homepage: https://github.com/adf0001/replace-file-by-list#readme
- Issues: https://github.com/adf0001/replace-file-by-list/issues
- npm.io page: https://npm.io/package/replace-file-by-list

## 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

- 1.0.2 (latest) — 2022-11-24
- 1.0.1 — 2022-11-24
- 1.0.0 — 2022-11-24

## README

# replace-file-by-list
replace files by a user-defined replacement list

# Install
```
npm install replace-file-by-list
```

# Usage & Api
```javascript

var replace_file_by_list = require("replace-file-by-list");

var replaceList = [
	"1.txt", [
		"bbbb", "b11b",
		/aaaa/g, "a22a"
	],
	"2.txt", [
		/.+/g, (s0) => { return s0 + "-" + s0.length; },
	],
]

/*
replace files by a user-defined replacement list

replaceFileByList( replaceList [, options] )

	replaceList
		[
			filePath1, [
				rplArg1a, rplArg1b,
				rplArg2a, rplArg2b,
				...
			],
			filePath2, [ ... ],
		]

		* rplArgNa, rplArgNb
			a pair of arguments for String.replace(rplArgNa, rplArgNb)

	options
		.srcDir
			optional, source dir path.
		.destDir
			optional, detination dir path.
			default is same as srcDir, i.e. write to the source files.

		.silent
			don't output log message

return updated files count.
*/
var cnt = replace_file_by_list(
	replaceList,
	{
		srcDir: __dirname + "/sample",
		destDir: __dirname + "/sample/output",
	}
);

```

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