{"id":29724567,"url":"https://github.com/mastersign/gulp-text-simple","last_synced_at":"2025-10-14T14:45:13.697Z","repository":{"id":1987251,"uuid":"45471320","full_name":"mastersign/gulp-text-simple","owner":"mastersign","description":"simple creation of Gulp transformations for text files","archived":false,"fork":false,"pushed_at":"2024-08-31T15:49:26.000Z","size":217,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-03T23:32:44.332Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/mastersign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-03T14:19:09.000Z","updated_at":"2022-04-28T06:32:27.000Z","dependencies_parsed_at":"2024-06-19T06:14:35.995Z","dependency_job_id":"a248e186-09c2-4df8-b9e5-ea5958124b60","html_url":"https://github.com/mastersign/gulp-text-simple","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/mastersign/gulp-text-simple","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2Fgulp-text-simple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2Fgulp-text-simple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2Fgulp-text-simple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2Fgulp-text-simple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mastersign","download_url":"https://codeload.github.com/mastersign/gulp-text-simple/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2Fgulp-text-simple/sbom","scorecard":{"id":623151,"data":{"date":"2025-08-11","repo":{"name":"github.com/mastersign/gulp-text-simple","commit":"9275f91ddf54ef1f97ce87e20f847df70b130aa4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T05:39:13.456Z","repository_id":1987251,"created_at":"2025-08-21T05:39:13.464Z","updated_at":"2025-08-21T05:39:13.464Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019162,"owners_count":26086685,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-07-24T21:21:53.188Z","updated_at":"2025-10-14T14:45:13.660Z","avatar_url":"https://github.com/mastersign.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"GulpText _simple_\n=================\n\n[![npm package][npm-img]][npm-url]\n[![dependency status][libraries-img]][libraries-url]\n[![build status][travis-img]][travis-url]\n\n\u003e simple creation of [Gulp] transformations for text files\n\nA lot of [Gulp] tasks are dealing with text files.\nAnd often you want to just create a simple task for transforming the text content of a file in your project.\nE.g. replace some placeholders with a regular expression.\nBut if you want to write a custom [Gulp] task for it, you have to deal with buffers, encoding, streams, different vinyl objects, ....\n\nGulpText _simple_ makes it really simple to create first class [Gulp] transformations with a simple API,\nand an extra benefit of helper functions for dealing with files directly.\n\nMinimal NodeJS version is currently version 16.\nFor older NodeJS versions use gulp-text-simple v0.5.x.\n\nFeatures\n--------\n\n* support for buffer file objects\n* support for stream file objects\n* supports passing additional [options](#options) to the transformation function\n* passing the [source path](#source-path) of the vinyl file as an option into the transformation function\n* control the input and output [encoding](#encoding)\n* the transformation factory behaves [like the transformation function](#use-as-a-function),\n  if the first argument is a string\n* read and transform the content of a text file [synchronously](#read-and-transform-synchronously)\n  and [asynchronously](#read-and-transform-asynchronously)\n* transform a text file [synchronously](#read-transform-and-write-synchronously)\n  and [asynchronously](#read-transform-and-write-asynchronously)\n* automatic JSON conversion of non-string results from the transformation function\n\nIntroduction\n------------\n\nAll examples are based on the following preamble.\n\n``` js\nvar gulp = require('gulp');\nvar textTransformation = require('gulp-text-simple');\n```\n\nWith GulpText _simple_ you can just implement a function, taking a string and returning a string.\nIt will create a [Gulp] transformation factory for you, which you can use with `.pipe()`.\n\n``` js\nvar transformString = function (s) {\n    // do whatever you want with the text content of a file\n    return s.toLowerCase();\n};\n\n// create the factory with GulpText simple\nvar myTransformation = textTransformation(transformString);\n\ngulp.task('default', function () {\n    return gulp.src('src/*.txt')\n        .pipe(myTransformation()) // create the Gulp transformation and insert it into the Gulp stream\n        .pipe(gulp.dest('out/'));\n});\n```\n\nOptions\n-------\n\nIf you need to pass options, you can give them as a map to the factory.\n\n``` js\nvar transformString = function (s, options) {\n    // do whatever you want with the text content of a file\n    if (options.mode === 'lower') {\n        return s.toLowerCase();\n    } else if (options.mode === 'upper') {\n        return s.toUpperCase();\n    } else {\n        return s;\n    }\n};\n\n// create the Gulp transformation factory with GulpText simple\nvar myTransformation = textTransformation(transformString);\n\ngulp.task('default', function () {\n    return gulp.src('src/*.txt')\n        .pipe(myTransformation({ mode: 'upper' })) // create the transformation with options\n        .pipe(gulp.dest('out/'));\n});\n```\n\n### Default Options\n\nIf you want to pepare default options for a transformation,\nyou can pass them to GulpText _simple_ as second argument.\n\n``` js\nvar transformString = function (s, options) {\n    assert.equal(options.myOption, 'abc');\n    return s;\n};\n\n// create the Gulp transformation factory with default options\nvar myTransformation = textTransformation(transformString, { myOption: 'abc' });\n\ngulp.task('default', function () {\n    return gulp.src('src/*.txt')\n        .pipe(myTransformation()) // create the transformation without options\n        .pipe(gulp.dest('out/'));\n});\n```\n\n### Encoding\n\nYou can control the encoding of reading and writing files and buffers\nwith the options `sourceEncoding` and `targetEncoding`.\n\n``` js\nvar myTransformation = textTransformation(function (s) { \n    return s.toLowerCase(); \n});\n\ngulp.task('default', function () {\n    return gulp.src('src/*.txt')\n        .pipe(myTransformation({ // create the transformation with explicit encoding\n            sourceEncoding: 'utf16le',\n            targetEncoding: 'utf8'\n        }))\n        .pipe(gulp.dest('out/'));\n});\n``` \n\nThe default encoding for input is UTF-8.\nThe default encoding for output is the encoding of the input.\nAllowed are all encodings, supported by [Buffer].\n\n### Source Path\n\nThe source path of a file is allways passed as option `sourcePath` to the transformation function.\nIf the custom options allready have an attribute `sourcePath` it is _not_ overridden.\n\n``` js\nvar os = require('os');\n\nvar transformString = function (text, options) {\n    // putting the source path as a prefix at the top of the text\n    var prefix = options.prefix; // custom options are preserved\n    var pathOfFile = options.sourcePath; // the sourcePath is merged into the custom options\n    return prefix + pathOfFile + os.EOL + text;\n};\n\n// create the Gulp transformation factory\nvar myTransformation = textTransformation(transformString);\n\ngulp.task('default', function () {\n    return gulp.src('src/*.txt')\n        .pipe(myTransformation({ prefix: '# ' })) // create the transformation and pass it to Gulp\n        .pipe(gulp.dest('out/'));\n});\n```\n\nAPI\n---\n\nCalling GulpText _simple_ creates a factory which can be used in a number of different ways:\n\n* call `t(\"text\"[, options])` like the original transformation function\n* call `t([options])`, to create a Gulp transformation\n* call `t.readFile(filePath[, options], callback)` to read and transform a file asynchronously\n* call `t.readFileSync(filePath[, options])` to read and transform a file synchronously\n* call `t.transformFile(sourcePath, targetPath[, options], callback)` to read, transform, and write a file asynchronously\n* call `t.transformFileSync(sourcePath, targetPath[, options])` to read, transform, and write a file synchronously\n\n### Usa as a Function\n\nYou can call the factory like the original transformation function.\nIf the first argument passed to the factory is a string,\nit behaves like the transformation function.\n\n``` js\nvar transformString = function (s, options) {\n    // do whatever you want with the text content of a file\n    return s.toLowerCase();\n};\n\n// create the factory with GulpText simple\nvar transformation = textTransformation(transformString);\n\n// call the factory as if it where the original transformation function\nvar result = transformation(\"ABC\");\nconsole.log(result); // -\u003e abc\n```\n\n### Use with Gulp\n\nYou can use the factory to create a [Gulp] transformation.\n\n``` js\nvar transformString = function (s) {\n    // do whatever you want with the text content of a file\n    return s.toLowerCase();\n};\n\n// create the factory with GulpText simple\nvar myTransformation = textTransformation(transformString);\n\ngulp.task('default', function () {\n    return gulp.src('src/*.txt')\n        .pipe(myTransformation()) // create the Gulp transformation and insert it into the Gulp stream\n        .pipe(gulp.dest('out/'));\n});\n```\n\n### Read and transform asynchronously\n\nYou can call `.readFile(filePath[, options], callback)` on the factory,\nto read and transform the content of a file asynchronously.\n\n``` js\nvar myTransformation = textTransformation(function (s) {\n    return s.toLowerCase();\n});\n\nmyTransformation.readFile('my/text_file.txt', function (err, result) {\n    if (err) {\n        console.log(err);\n    } else {\n        console.log(result);\n    }\n});\n```\n\n### Read and transform synchronously\n\nYou can call `.readFileSync(filePath[, options])` on the factory,\nto read and transform the content of a file synchronously.\n\n``` js\nvar myTransformation = textTransformation(function (s) {\n    return s.toLowerCase();\n});\n\nvar result = myTransformation.readFileSync('my/text_file.txt');\nconsole.log(result);\n```\n\n### Read, transform, and write asynchronously\n\nYou can call `.transformFile(sourcePath, targetPath[, options], callback)` on the factory,\nto read, transform, and write the content of a file asynchronously.\n\n``` js\nvar myTransformation = textTransformation(function (s) {\n    return s.toLowerCase();\n});\n\nmyTransformation.transformFile('my/text_file.txt', 'my/result.txt', function (err) {\n    if (err) {\n        console.log(err);\n    }\n});\n```\n\n### Read, transform, and write synchronously\n\nYou can call `.transformFileSync(sourcePath, targetPath[, options])` on the factory,\nto read, transform, and write the content of a file synchronously.\n\n``` js\nvar myTransformation = textTransformation(function (s) {\n    return s.toLowerCase();\n});\n\nmyTransformation.transformFileSync('my/text_file.txt', 'my/result.txt');\n```\n\nLicense\n-------\n\nGulpText _simple_ is published under MIT license.\n\n[npm-url]: https://www.npmjs.com/package/gulp-text-simple\n[npm-img]: https://img.shields.io/npm/v/gulp-text-simple.svg\n[travis-img]: https://img.shields.io/travis/mastersign/gulp-text-simple/master.svg\n[travis-url]: https://travis-ci.org/mastersign/gulp-text-simple\n[libraries-url]: https://libraries.io/npm/gulp-text-simple\n[libraries-img]: https://img.shields.io/librariesio/github/mastersign/gulp-text-simple.svg\n[Gulp]: http://gulpjs.com\n[Buffer]: https://nodejs.org/api/buffer.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastersign%2Fgulp-text-simple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmastersign%2Fgulp-text-simple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastersign%2Fgulp-text-simple/lists"}