Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binocarlos/process-folder
Loop recursively over files in a folder, pipe them to stdin of a command and write the output to a target folder.
https://github.com/binocarlos/process-folder
Last synced: 11 days ago
JSON representation
Loop recursively over files in a folder, pipe them to stdin of a command and write the output to a target folder.
- Host: GitHub
- URL: https://github.com/binocarlos/process-folder
- Owner: binocarlos
- License: mit
- Created: 2014-10-29T16:07:13.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-29T16:09:06.000Z (about 10 years ago)
- Last Synced: 2024-11-04T07:02:32.225Z (16 days ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
process-folder
==============Loop recursively over files in a folder, pipe them to stdin of a command and write the output to a target folder.
[![Travis](http://img.shields.io/travis/binocarlos/process-folder.svg?style=flat)](https://travis-ci.org/binocarlos/process-folder)
## install
```
$ npm install process-folder
```## usage
```js
var processFolder = require('process-folder')var processor = processFolder({
source:__dirname + '/fixtures/src',
dest:__dirname + '/fixtures/build',
command:'mercury-jsx',
args:[],
filter:function(file){
return file.match(/\.jsx/)
},
rename:function(file){
return file.replace(/\.jsx/, '.js')
}
})processor.on('file', function(source, target){
console.log('processing: ' + path)
})processor.run(function(err){
console.log('all .jsx have been processed into .js')
})
```The above example will load all `.jsx` files from `__dirname + '/fixtures/src'` and pipe them via a `mercury-jsx`.
The results of each file will be written to `__dirname + '/fixtures/build'` with the .jsx suffix replaced with .js
## license
MIT