{"id":19341839,"url":"https://github.com/samvera/hydra-file_characterization","last_synced_at":"2025-07-16T19:35:23.800Z","repository":{"id":10647610,"uuid":"12876208","full_name":"samvera/hydra-file_characterization","owner":"samvera","description":"Samvera file characterization (extracted from Sufia)","archived":false,"fork":false,"pushed_at":"2024-10-01T19:08:09.000Z","size":164,"stargazers_count":2,"open_issues_count":4,"forks_count":6,"subscribers_count":58,"default_branch":"main","last_synced_at":"2025-07-04T06:06:55.710Z","etag":null,"topics":["core-components","samvera-community"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samvera.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-09-16T19:15:32.000Z","updated_at":"2024-10-01T19:08:10.000Z","dependencies_parsed_at":"2024-11-10T03:32:56.410Z","dependency_job_id":"12375dc9-97f4-402e-9936-0aa8254e81ee","html_url":"https://github.com/samvera/hydra-file_characterization","commit_stats":null,"previous_names":["projecthydra/hydra-file_characterization"],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/samvera/hydra-file_characterization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvera%2Fhydra-file_characterization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvera%2Fhydra-file_characterization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvera%2Fhydra-file_characterization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvera%2Fhydra-file_characterization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samvera","download_url":"https://codeload.github.com/samvera/hydra-file_characterization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvera%2Fhydra-file_characterization/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265534829,"owners_count":23783897,"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":["core-components","samvera-community"],"created_at":"2024-11-10T03:32:43.734Z","updated_at":"2025-07-16T19:35:23.769Z","avatar_url":"https://github.com/samvera.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hydra-file_characterization\n\nCode:\n[![Gem Version](https://badge.fury.io/rb/hydra-file_characterization.png)](http://badge.fury.io/rb/hydra-file_characterization)\n[![Build Status](https://circleci.com/gh/samvera/hydra-file_characterization.svg?style=svg)](https://circleci.com/gh/samvera/hydra-file_characterization)\n[![Coverage Status](https://coveralls.io/repos/github/samvera/hydra-file_characterization/badge.svg?branch=main)](https://coveralls.io/github/samvera/hydra-file_characterization?branch=main)\n\nDocs:\n[![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)\n[![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)\n\nCommunity Support: [![Samvera Community Slack](https://img.shields.io/badge/samvera-slack-blueviolet)](http://slack.samvera.org/)\n\n# What is hydra-file_characterization?\n\nProvides a wrapper for file characterization.\n\n# Supported versions\n\nThis software is currently tested against: \n* FITS 1.4.1\n* Ruby 2.6, 2.7, and 3.0\n* Rails 6.0, 6.1, and 7.0\n\n## Product Owner \u0026 Maintenance\n\n`hydra-file_characterization` was a Core Component of the Samvera Community. Given a decline in available labor required for maintenance, this project no longer has a dedicated Product Owner. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).\n\n### Product Owner\n\n**Vacant**\n\n_Until a Product Owner has been identified, we ask that you please direct all requests for support, bug reports, and general questions to the [`#dev` Channel on the Samvera Slack](https://samvera.slack.com/app_redirect?channel=dev)._\n\n# Help\n\nThe Samvera community is here to help. Please see our [support guide](./SUPPORT.md).\n\n# Getting Started\n\nIf you are using Rails add the following to an initializer (./config/initializers/hydra-file_characterization_config.rb):\n\n```ruby\nHydra::FileCharacterization.configure do |config|\n  config.tool_path(:fits, '/path/to/fits')\nend\n```\n\n```ruby\nHydra::FileCharacterization.characterize(File.read(filename), File.basename(filename), :fits)\n```\n\n- Why `file.read`? To highlight that we want a string. In the case of ActiveFedora, we have a StringIO instead of a file.\n- Why `file.basename`? In the case of Fits, the characterization takes cues from the extension name.\n\nYou can call a single characterizer...\n\n```ruby\nxml_string = Hydra::FileCharacterization.characterize(File.read(\"/path/to/my/file.rb\"), 'file.rb', :fits)\n```\n\n...for this particular call, you can specify custom fits path...\n\n```ruby\nxml_string = Hydra::FileCharacterization.characterize(contents_of_a_file, 'file.rb', :fits) do |config|\n  config[:fits] = './really/custom/path/to/fits'\nend\n```\n\n...or even make the path callable...\n\n```ruby\nxml_string = Hydra::FileCharacterization.characterize(contents_of_a_file, 'file.rb', :fits) do |config|\n  config[:fits] = lambda {|filename| … }\nend\n```\n\n...or even create your custom characterizer on the file...\n\n```ruby\nxml_string = Hydra::FileCharacterization.characterize(contents_of_a_file, 'file.rb', :my_characterizer) do |config|\n  config[:my_characterizer] = lambda {|filename| … }\nend\n```\n\nYou can also call multiple characterizers at the same time.\n\n```ruby\nfits_xml, ffprobe_xml = Hydra::FileCharacterization.characterize(contents_of_a_file, 'file.rb', :fits, :ffprobe)\n```\n\n## Registering New Characterizers\n\nThis is possible by adding a characterizer to the `Hydra::FileCharacterization::Characterizers` namespace.\n\n## Contributing \n\nRunning the tests: \n* Install FITS v1.4.1, which is the most recent version we've tested against.\n```\nmkdir ~/fits\nwget \"https://github.com/harvard-lts/fits/releases/download/1.4.1/fits-1.4.1.zip\"\nunzip -d ~/fits/ \"fits-1.4.1.zip\"\nchmod a+x ~/fits/fits.sh\nln -s ~/fits/fits.sh ~/fits/fits\nrm \"fits-1.4.1.zip\"\n```\n\n* Once FITS is installed, you should be able to run the tests with: `rspec spec`\n\n\nIf you're working on PR for this project, create a feature branch off of `main`. \n\nThis repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct) and [language recommendations](https://github.com/samvera/maintenance/blob/master/templates/CONTRIBUTING.md#language).  Please ***do not*** create a branch called `master` for this repository or as part of your pull request; the branch will either need to be removed or renamed before it can be considered for inclusion in the code base and history of this repository.\n\n## Releasing\n\n1. `bundle install`\n2. Increase the version number in `lib/hydra/file_characterization/version.rb`\n3. Increase the same version number in `.github_changelog_generator`\n4. Update `CHANGELOG.md` by running this command:\n\n  ```\n  github_changelog_generator --user samvera --project hydra-file_characterization --token YOUR_GITHUB_TOKEN_HERE\n  ```\n\n5. Commit these changes to the master branch\n6. Run `rake release`\n\n# Acknowledgments\n\nThis software has been developed by and is brought to you by the Samvera community. Learn more at the [Samvera website](http://samvera.org/).\n\n![Samvera Logo](https://samvera.org/wp-content/uploads/2017/06/samvera-logo-tm.svg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamvera%2Fhydra-file_characterization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamvera%2Fhydra-file_characterization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamvera%2Fhydra-file_characterization/lists"}