{"id":19322927,"url":"https://github.com/mrgaogang/react-native-file-hash-plugin","last_synced_at":"2026-03-10T07:03:40.553Z","repository":{"id":57336966,"uuid":"303874643","full_name":"MrGaoGang/react-native-file-hash-plugin","owner":"MrGaoGang","description":"create file hash in react-native","archived":false,"fork":false,"pushed_at":"2020-12-11T09:32:43.000Z","size":81,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T13:47:16.794Z","etag":null,"topics":["file","file-hash","hash","react-native","react-native-hash"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/MrGaoGang.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":"2020-10-14T01:51:41.000Z","updated_at":"2023-08-01T01:31:58.000Z","dependencies_parsed_at":"2022-09-12T11:03:03.978Z","dependency_job_id":null,"html_url":"https://github.com/MrGaoGang/react-native-file-hash-plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/MrGaoGang/react-native-file-hash-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrGaoGang%2Freact-native-file-hash-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrGaoGang%2Freact-native-file-hash-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrGaoGang%2Freact-native-file-hash-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrGaoGang%2Freact-native-file-hash-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrGaoGang","download_url":"https://codeload.github.com/MrGaoGang/react-native-file-hash-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrGaoGang%2Freact-native-file-hash-plugin/sbom","scorecard":{"id":96634,"data":{"date":"2025-08-11","repo":{"name":"github.com/MrGaoGang/react-native-file-hash-plugin","commit":"b2d967ef1de2f6d6d4a880b872557b8dd502a59f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"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":"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/14 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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/MrGaoGang/react-native-file-hash-plugin/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/MrGaoGang/react-native-file-hash-plugin/main.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/main.yml:28","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"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":"Vulnerabilities","score":0,"reason":"23 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx","Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"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-15T09:11:26.701Z","repository_id":57336966,"created_at":"2025-08-15T09:11:26.701Z","updated_at":"2025-08-15T09:11:26.701Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30326893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["file","file-hash","hash","react-native","react-native-hash"],"created_at":"2024-11-10T01:43:06.140Z","updated_at":"2026-03-10T07:03:40.515Z","avatar_url":"https://github.com/MrGaoGang.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-file-hash-plugin\n\ncreate file `hash` and `transform` asset  in react-native **bundle**! when you use `react-native run-ios/run-android`  it will not work, it is just use in `react-native bundle ...`\n\n## Installation\n\n**npm**\n\n```bash\nnpm install --save-dev react-native-file-hash-plugin\n```\n\n**metro**\n\nAdd `react-native-file-hash-plugin` to the list of assetPlugins in your `metro.config.js` file under the transformer section.\n\nfor example :\n\n```js\n/**\n * Metro configuration for React Native\n * https://github.com/facebook/react-native\n *\n * @format\n */\n\nmodule.exports = {\n  transformer: {\n    getTransformOptions: async () =\u003e ({\n      transform: {\n        experimentalImportSupport: false,\n        inlineRequires: false,\n      },\n    }),\n    assetPlugins: [\"react-native-file-hash-plugin\"],\n  },\n};\n```\n\n## Configuration\n\nYou can configure the plugin behaviour through the optional `fileHashPlugin` field in your `metro.config.js` file under the `transformer` section.\n\nFor example:\n\n```js\nmodule.exports = {\n  transformer: {\n    getTransformOptions: async () =\u003e ({\n      transform: {\n        experimentalImportSupport: false,\n        inlineRequires: false,\n      },\n    }),\n    assetPlugins: [\"react-native-file-hash-plugin\"],\n  },\n  fileHashPlugin: {\n    // optional\n    // the file type to hash,default is png,jpeg,jpg,gif\n    types: [\"png\", \"jpeg\", \"jpg\", \"gif\"],\n    // optional\n    // the input params is file name and file path; the output is hash string ,default is react-native hash\n    hashFunction: (fileName, path) =\u003e {\n      return \"your hash\";\n    },\n    // optional\n    // the  ignore file path regex\n    ignoreRegex: null,\n    // optional\n    // add external options to asset, resturn must be object\n    externalOptions: (fileName, path) =\u003e {\n      return {\n        key: \"mrgaogang\",\n      };\n    },\n  },\n};\n```\n\n## Output\n\nexample:\n\n```bash\nreact-native bundle --entry-file index.js --bundle-output ./bundle/ios.bundle --platform ios --reset-cache --assets-dest ./bundle --dev false\n\n```\n\n**suggest to add `--reset-cache ` params.**\n\nwill output like this, and the file will add hash string.\n\n```js\n├─assets\n│ ├─app.json\n│ ├─img\n│ │ └─success-c64ef9278d09de068787ded3a56ed560.png\n│ └─node_modules\n│   └─react-native\n│     └─Libraries\n└─ios.bundle\n\n```\n\n## Others\n\nif you want to transform Images, also you can use `Image.resolveAssetSource.setCustomSourceTransformer`,\n\n```js\nImage.resolveAssetSource.setCustomSourceTransformer((resolver) =\u003e {\n  // do any thing you want\n  if (Platform.OS === 'android') {\n      return this.isLoadedFromFileSystem()\n        ? this.drawableFolderInBundle()\n        : this.resourceIdentifierWithoutScale();\n    } else {\n      return this.scaledAssetURLNearBundle();\n    }\n});\n\n```\n\nthe `resolver` is:\n\n```js\n // node_modules/react-native/Libraries/Image/AssetSourceResolver.js\n  serverUrl: ?string;\n  // where the jsbundle is being run from\n  jsbundleUrl: ?string;\n  // the asset to resolve\n  asset: PackagerAsset;\n  \n // PackagerAsset is \n export type PackagerAsset = {\n  +__packager_asset: boolean,\n  +fileSystemLocation: string,\n  +httpServerLocation: string,\n  +width: ?number,\n  +height: ?number,\n  +scales: Array\u003cnumber\u003e,\n  +hash: string,\n  +name: string,\n  +type: string,\n  ...\n};\n  \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrgaogang%2Freact-native-file-hash-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrgaogang%2Freact-native-file-hash-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrgaogang%2Freact-native-file-hash-plugin/lists"}