mehulkar
mehulkar

Reputation: 4974

How to tar the contents of a directory (vs the directory itself) using node

If I have a directory:

my_directory
  --file1
  --file2
  --file3

I can do this:

tar -cvf my_tar.tar my_directory/*

Is this possible with some node module like node-tar or tar-fs or something else?

Upvotes: 0

Views: 395

Answers (1)

alex
alex

Reputation: 12265

Simple answer would be:

require('child_process').execFile('tar', ['-cvf','my_tar.tar','my_directory/*'])

Upvotes: 1

Related Questions