GithubHelp home page GithubHelp logo

isabella232 / ffi-libarchive Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chef/ffi-libarchive

0.0 0.0 0.0 334 KB

A Ruby FFI binding to libarchive.

License: Apache License 2.0

Ruby 98.56% Shell 1.44%

ffi-libarchive's Introduction

ffi-libarchive

Build status Gem Version

Umbrella Project: Chef Foundation

Project State: Active

Issues Response Time Maximum: 14 days

Pull Request Response Time Maximum: 14 days

A Ruby FFI binding to [libarchive][0].

This library provides Ruby FFI bindings to the well-known libarchive library.

Installation

Ensure that you have libarchive installed. On Debian/Ubuntu:

apt install libarchive13

On macOS with Homebrew:

brew install libarchive

Add this line to your application's Gemfile:

gem 'ffi-libarchive'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ffi-libarchive

Usage

To extract an archive into the current directory:

flags = Archive::EXTRACT_PERM
reader = Archive::Reader.open_filename('/path/to/archive.tgz')

reader.each_entry do |entry|
  reader.extract(entry, flags.to_i)
end
reader.close

To create a gzipped tar archive:

Archive.write_open_filename('my.tgz', Archive::COMPRESSION_GZIP, Archive::FORMAT_TAR_PAX_RESTRICTED) do |tar|
  content = File.read 'some_path'
  size = content.size
  tar.new_entry do |e|
    e.pathname = 'some_path'
    e.size = size
    e.filetype = Archive::Entry::FILE
    tar.write_header e
    tar.write_data content
  end
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/chef/ffi-libarchive. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Community Guidelines code of conduct.

License

  • License:: Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

ffi-libarchive's People

Contributors

tas50 avatar chef-ci avatar dependabot-preview[bot] avatar jatoben avatar thommay avatar dependabot[bot] avatar f-fr avatar lamont-granquist avatar skeshari12 avatar bdwyertech avatar jasonwbarnett avatar johnbellone avatar hartmantis avatar phiggins avatar prajaktapurohit avatar tduffield avatar chef-expeditor[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.