pvpscript / pytar

An extremely simple tar wrapper that adds data as files in a tarball

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pytar

An extremely simple tar wrapper that adds data as files in a tarball

Introduction

I wrote this code for a script I was writing that required raw data to be added as files and compressed inside a tarball. It makes use of the native python lib, tarfile

Usage

from pytar import Tar

with Tar('/home/user/filename.tar.gz') as tarball:
    tarball.add_file('hello.txt', 'Hello, World!')
    tarball.add_file('bye.txt', 'Goodbye, World!')

The example above will create, in the /home/user path, a file called filename.tar.gz that will have two files, hello.txt and bye.txt.

About

An extremely simple tar wrapper that adds data as files in a tarball

License:MIT License


Languages

Language:Python 100.0%