extractor.cr
extractor.cr
Crystal bindings to libextractor, a library for extracting metadata from a variety of file formats. Inspired by the Ruby [ffi-extractor] gem and should be API compatible.
libextractor is a simple library for keyword extraction. libextractor does not support all formats but supports a simple plugging mechanism such that you can quickly add extractors for additional formats, even without recompiling libextractor. libextractor typically ships with a dozen helper-libraries that can be used to obtain keywords from common file-types.
libextractor is a part of the GNU project.
Installation
-
Install
libextractor
-
Debian / Ubuntu:
$ sudo apt-get install libextractor-dev libextractor-plugins-all
-
RedHat / Fedora:
$ sudo dnf install libextractor-devel libextractor-plugins
-
Brew:
$ brew install libextractor
-
-
Add the dependency to your
shard.yml
:dependencies: extractor: github: postmodern/extractor.cr
-
Run
shards install
Requirements
- libextractor >= 0.6.0
Examples
require "extractor"
Extractor.extract(string) do |plugin_name,type,format,mime_type,data|
p {plugin, type, format, mime_type,data}
end
Extractor.extract_from("path/to/image.jpg") do |plugin_name,type,format,mime_type,data|
p {plugin, type, format, mime_type,data}
end
Development
- Install
libextractor
(See Installation) git clone https://github.com/postmodern/extractor.cr.git
cd extractor.cr
crystal spec
Contributing
- Fork it (https://github.com/postmodern/extractor.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Postmodern - creator and maintainer
Copyright
extractor.cr - Crystal bindings for libextractor
Copyright (c) 2020 - Hal Brodigan (postmodern.mod3 at gmail.com)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
extractor.cr
- 3
- 0
- 0
- 0
- 1
- about 3 years ago
- August 5, 2020
GNU General Public License v3.0
Thu, 07 Nov 2024 03:48:55 GMT