{"id":17402772,"url":"https://github.com/thlorenz/mutiny","last_synced_at":"2025-06-11T17:03:51.153Z","repository":{"id":12352844,"uuid":"14998712","full_name":"thlorenz/mutiny","owner":"thlorenz","description":"Recursively mutates files in a given directory.","archived":false,"fork":false,"pushed_at":"2014-03-30T03:52:52.000Z","size":340,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-27T08:53:04.234Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/thlorenz/mutiny","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thlorenz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-07T02:49:18.000Z","updated_at":"2015-12-07T23:57:42.000Z","dependencies_parsed_at":"2022-09-26T18:30:28.615Z","dependency_job_id":null,"html_url":"https://github.com/thlorenz/mutiny","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fmutiny","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fmutiny/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fmutiny/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fmutiny/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thlorenz","download_url":"https://codeload.github.com/thlorenz/mutiny/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fmutiny/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259209959,"owners_count":22822275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-16T18:23:46.594Z","updated_at":"2025-06-11T17:03:51.129Z","avatar_url":"https://github.com/thlorenz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mutiny [![build status](https://secure.travis-ci.org/thlorenz/mutiny.png)](http://travis-ci.org/thlorenz/mutiny)\n\nRecursively mutates files in a given directory.\n\n```js\nvar through = require('through2');\nvar mutiny = require('mutiny');\n\nfunction toUpper(file, content) {\n  return through(\n    function (chunk, enc, cb) {\n      this.push(chunk.toUpperCase());\n      cb();\n    }\n  )\n}\n\nvar readdirpOpts = { root: __dirname + '/root' };\nmutiny({ outdir: __dirname + '/out', transform: [ toUpper ]}, readdirpOpts)\n  .on('error', console.error)\n  .on('data', function (d) { console.log('\\nProcessed:\\n', d); })\n```\n[transform example](https://github.com/thlorenz/mutiny/tree/master/examples/transform-only.js)\n\n```sh\n# assuming trim-leading is a transform installed as a node_module\nmutiny ./root -t ./local-transform/toUpper.js -t trim-leading -o ./out \n```\n[bin example](https://github.com/thlorenz/mutiny/tree/master/examples/bin)\n\n## Installation\n\n    npm install mutiny\n\n## API\n\n\u003c!-- START docme generated API please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN docme TO UPDATE --\u003e\n\n\u003cdiv class=\"jsdoc-githubify\"\u003e\n\u003csection\u003e\n\u003carticle\u003e\n\u003cdiv class=\"container-overview\"\u003e\n\u003cdl class=\"details\"\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cdl\u003e\n\u003cdt\u003e\n\u003ch4 class=\"name\" id=\"mutiny\"\u003e\u003cspan class=\"type-signature\"\u003e\u003c/span\u003emutiny\u003cspan class=\"signature\"\u003e(mutinyopts, readopts)\u003c/span\u003e\u003cspan class=\"type-signature\"\u003e \u0026rarr; {ReadStream}\u003c/span\u003e\u003c/h4\u003e\n\u003c/dt\u003e\n\u003cdd\u003e\n\u003cdiv class=\"description\"\u003e\n\u003cp\u003eMutates the files of a directory recursively applying specified transform and/or a rename function.\nThe transformed files are saved into the outdir and directory structure is maintained.\u003c/p\u003e\n\u003c/div\u003e\n\u003ch5\u003eParameters:\u003c/h5\u003e\n\u003ctable class=\"params\"\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eName\u003c/th\u003e\n\u003cth\u003eType\u003c/th\u003e\n\u003cth class=\"last\"\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd class=\"name\"\u003e\u003ccode\u003emutinyopts\u003c/code\u003e\u003c/td\u003e\n\u003ctd class=\"type\"\u003e\n\u003cspan class=\"param-type\"\u003eObject\u003c/span\u003e\n\u003c/td\u003e\n\u003ctd class=\"description last\"\u003e\n\u003ch6\u003eProperties\u003c/h6\u003e\n\u003ctable class=\"params\"\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eName\u003c/th\u003e\n\u003cth\u003eType\u003c/th\u003e\n\u003cth class=\"last\"\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd class=\"name\"\u003e\u003ccode\u003eoutdir:\u003c/code\u003e\u003c/td\u003e\n\u003ctd class=\"type\"\u003e\n\u003cspan class=\"param-type\"\u003eString\u003c/span\u003e\n\u003c/td\u003e\n\u003ctd class=\"description last\"\u003e\u003cp\u003ethe root of the directory to which to write the transformed/renamed files\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd class=\"name\"\u003e\u003ccode\u003etransform:\u003c/code\u003e\u003c/td\u003e\n\u003ctd class=\"type\"\u003e\n\u003cspan class=\"param-type\"\u003eArray.\u0026lt;(function()|String)\u003e\u003c/span\u003e\n\u003c/td\u003e\n\u003ctd class=\"description last\"\u003e\u003cp\u003ethat transform each file's content\u003c/p\u003e\n\u003cp\u003e \u003cstrong\u003etransform function signature:\u003c/strong\u003e \u003ccode\u003efunction(String):TransformStream\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003e \u003cstrong\u003eNote\u003c/strong\u003e: each transform can be a function or a name of an installed transform or a path to a local module\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd class=\"name\"\u003e\u003ccode\u003erename:\u003c/code\u003e\u003c/td\u003e\n\u003ctd class=\"type\"\u003e\n\u003cspan class=\"param-type\"\u003efunction\u003c/span\u003e\n\u003c/td\u003e\n\u003ctd class=\"description last\"\u003e\u003cp\u003erenames each file\u003c/p\u003e\n\u003cp\u003e \u003cstrong\u003esignature:\u003c/strong\u003e \u003ccode\u003efunction ({String} outfile, {String} outdir, {String} relativeOutfile) : {String} outfile\u003c/code\u003e\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd class=\"name\"\u003e\u003ccode\u003egetOutStream:\u003c/code\u003e\u003c/td\u003e\n\u003ctd class=\"type\"\u003e\n\u003cspan class=\"param-type\"\u003efunction\u003c/span\u003e\n\u003c/td\u003e\n\u003ctd class=\"description last\"\u003e\u003cp\u003eallows overriding the defaultOutStream in case rename is not sufficient\u003c/p\u003e\n\u003cp\u003e \u003cstrong\u003esignature:\u003c/strong\u003e \u003ccode\u003efunction ({String} outfile, {String} outdir, {String} relativeOutfile) : {WriteStream}\u003c/code\u003e\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd class=\"name\"\u003e\u003ccode\u003ereadopts\u003c/code\u003e\u003c/td\u003e\n\u003ctd class=\"type\"\u003e\n\u003cspan class=\"param-type\"\u003eObject\u003c/span\u003e\n\u003c/td\u003e\n\u003ctd class=\"description last\"\u003e\u003cp\u003eoptions passed through to \u003ca href=\"https://github.com/thlorenz/readdirp\"\u003ereaddirp\u003c/a\u003e\u003c/p\u003e\n\u003ch6\u003eProperties\u003c/h6\u003e\n\u003ctable class=\"params\"\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eName\u003c/th\u003e\n\u003cth\u003eType\u003c/th\u003e\n\u003cth class=\"last\"\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd class=\"name\"\u003e\u003ccode\u003eroot\u003c/code\u003e\u003c/td\u003e\n\u003ctd class=\"type\"\u003e\n\u003cspan class=\"param-type\"\u003eString\u003c/span\u003e\n\u003c/td\u003e\n\u003ctd class=\"description last\"\u003e\u003cp\u003ethe \u003ccode\u003eroot\u003c/code\u003e of the source directory that needs to be specified\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cdl class=\"details\"\u003e\n\u003cdt class=\"tag-source\"\u003eSource:\u003c/dt\u003e\n\u003cdd class=\"tag-source\"\u003e\u003cul class=\"dummy\"\u003e\n\u003cli\u003e\n\u003ca href=\"https://github.com/thlorenz/mutiny/blob/master/index.js\"\u003eindex.js\u003c/a\u003e\n\u003cspan\u003e, \u003c/span\u003e\n\u003ca href=\"https://github.com/thlorenz/mutiny/blob/master/index.js#L13\"\u003elineno 13\u003c/a\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\u003c/dd\u003e\n\u003c/dl\u003e\n\u003ch5\u003eReturns:\u003c/h5\u003e\n\u003cdiv class=\"param-desc\"\u003e\n\u003cp\u003ewhich emits 'error' and or 'data' to update mutiny's progress\u003c/p\u003e\n\u003c/div\u003e\n\u003cdl\u003e\n\u003cdt\u003e\nType\n\u003c/dt\u003e\n\u003cdd\u003e\n\u003cspan class=\"param-type\"\u003eReadStream\u003c/span\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\n\u003ch4 class=\"name\" id=\"transformContent\"\u003e\u003cspan class=\"type-signature\"\u003e\u003c/span\u003etransformContent\u003cspan class=\"signature\"\u003e(progress, transforms)\u003c/span\u003e\u003cspan class=\"type-signature\"\u003e\u003c/span\u003e\u003c/h4\u003e\n\u003c/dt\u003e\n\u003cdd\u003e\n\u003cdiv class=\"description\"\u003e\n\u003cp\u003eRuns all transforms on the content of all files that are piped into its file stream.\nReports progress by pushing into the @see progress stream.\u003c/p\u003e\n\u003c/div\u003e\n\u003ch5\u003eParameters:\u003c/h5\u003e\n\u003ctable class=\"params\"\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eName\u003c/th\u003e\n\u003cth\u003eType\u003c/th\u003e\n\u003cth class=\"last\"\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd class=\"name\"\u003e\u003ccode\u003eprogress\u003c/code\u003e\u003c/td\u003e\n\u003ctd class=\"type\"\u003e\n\u003cspan class=\"param-type\"\u003eStream\u003c/span\u003e\n\u003c/td\u003e\n\u003ctd class=\"description last\"\u003e\u003cp\u003einto which progress data is pushed\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd class=\"name\"\u003e\u003ccode\u003etransforms\u003c/code\u003e\u003c/td\u003e\n\u003ctd class=\"type\"\u003e\n\u003cspan class=\"param-type\"\u003eArray.\u0026lt;function(String): Stream\u003e\u003c/span\u003e\n\u003c/td\u003e\n\u003ctd class=\"description last\"\u003e\u003cp\u003efunctions that return a transform stream when invoked with a path to a file\n- signature of each transform: \u003ccode\u003efunction ({String} file) : {TransformStream}\u003c/code\u003e\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cdl class=\"details\"\u003e\n\u003cdt class=\"tag-source\"\u003eSource:\u003c/dt\u003e\n\u003cdd class=\"tag-source\"\u003e\u003cul class=\"dummy\"\u003e\n\u003cli\u003e\n\u003ca href=\"https://github.com/thlorenz/mutiny/blob/master/lib/transform-content.js\"\u003elib/transform-content.js\u003c/a\u003e\n\u003cspan\u003e, \u003c/span\u003e\n\u003ca href=\"https://github.com/thlorenz/mutiny/blob/master/lib/transform-content.js#L24\"\u003elineno 24\u003c/a\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/article\u003e\n\u003c/section\u003e\n\u003c/div\u003e\n\n*generated with [docme](https://github.com/thlorenz/docme)*\n\u003c!-- END docme generated API please keep comment here to allow auto update --\u003e\n\n## More Examples\n\nPlease find more examples in the [examples directory](https://github.com/thlorenz/mutiny/tree/master/examples) and consult the [tests](https://github.com/thlorenz/mutiny/tree/master/tests)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthlorenz%2Fmutiny","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthlorenz%2Fmutiny","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthlorenz%2Fmutiny/lists"}