https://github.com/abappm/abap-tar
Tar and Untar for ABAP
https://github.com/abappm/abap-tar
abap apm tar untar
Last synced: 26 days ago
JSON representation
Tar and Untar for ABAP
- Host: GitHub
- URL: https://github.com/abappm/abap-tar
- Owner: abapPM
- License: mit
- Created: 2022-06-03T11:33:19.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-04T14:45:38.000Z (about 1 month ago)
- Last Synced: 2025-04-14T15:07:47.223Z (about 1 month ago)
- Topics: abap, apm, tar, untar
- Language: ABAP
- Homepage: https://abappm.com
- Size: 106 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README

[](https://github.com/abapPM/ABAP-Tar/blob/main/LICENSE)
[](https://github.com/abapPM/.github/blob/main/CODE_OF_CONDUCT.md)
[](https://api.reuse.software/info/github.com/abapPM/ABAP-Tar)# Tar for ABAP
This is an implementation of the [ustar](https://en.wikipedia.org/wiki/Tar_(computing)) and [pax](https://en.wikipedia.org/wiki/Pax_(command)) tar formats.
Archives can be compressed and decompressed using [gzip and gunzip](https://en.wikipedia.org/wiki/Gzip) methods as well.
NO WARRANTIES, [MIT License](https://github.com/abapPM/ABAP-Tar/blob/main/LICENSE)
Limitations: Block size is hardcoded to 512 bytes
## Usage
### Tar Files
Here's an example of how to tar a list of files.
```abap
DATA your_files TYPE zcl_tar=>ty_files.DATA(tar) = zcl_tar=>new( ).
LOOP AT files INTO ls_file.
tar->append(
name = file-name
content = file-content
date = file-date
time = file-time
mode = file-mode
typeflag = file-typeflag ).
ENDLOOP.DATA(tar_data) = tar->save( ).
" Gzip
DATA(packed_data) = tar->gzip( tar_data ).
```### Untar Files
Here's an example of how to untar a file.
```abap
DATA:
your_data TYPE xstring,
unpacked_data TYPE xstring.DATA(tar) = zcl_tar=>new( ).
" Gunzip
IF filename CP '*.tgz' OR filename CP '*.tar.gz'.
unpacked_data = tar->gunzip( your_data ).
ELSE.
unpacked_data = your_data.
ENDIF.tar->load( unpacked_data ).
```List the files and get file content:
```abap
DATA(files) = tar->list( ).LOOP AT files INTO DATA(file).
DATA(content) = tar->get( file-name ).
" ...
ENDLOOP.
```You can use program `Z_TAR_TESTER` to test the methods:
- upload a tar file
- untar it
- tar it again
- save it as a clone of the original tar file## Prerequisites
SAP Basis 7.50 or higher
## Installation
Install `tar` as a global module in your system using [apm](https://abappm.com).
or
Specify the `tar` module as a dependency in your project and import it to your namespace using [apm](https://abappm.com).
## Contributions
All contributions are welcome! Read our [Contribution Guidelines](https://github.com/abapPM/ABAP-Tar/blob/main/CONTRIBUTING.md), fork this repo, and create a pull request.
You can install the developer version of ABAP Tar using [abapGit](https://github.com/abapGit/abapGit) by creating a new online repository for `https://github.com/abapPM/ABAP-Tar`.
Recommended SAP package: `$TAR`
## About
Made with ❤ in Canada
Copyright 2025 apm.to Inc.
Follow [@marcf.be](https://bsky.app/profile/marcf.be) on Blueksy and [@marcfbe](https://linkedin.com/in/marcfbe) or LinkedIn