Skip to content

tar

import { tar, untar } from 'sysopkit/op/tar';

Creates an archive from a directory on the target host. Emits a change event on every run.

await tar({ src: '/var/www', dst: '/backup/www.tar.gz' });

Extracts an archive into a directory on the target host. Emits a change event on every run.

await untar({ src: '/backup/www.tar.gz', dst: '/var/www' });

Both functions accept src, dst, and an optional exclude list of patterns passed through as --exclude flags:

await tar({ src: '/var/www', dst: '/backup/www.tar.gz', exclude: ['*.log'] });