I like to think of myself as reasonably computer and google literate (I'm OK ar searching the web). However I've recently had the need to compress into .ngz format and for the life of me I can't find a program that will allow me to compress into that format. I can open the files with 7zip, but it wont allow me to create an ngz archive. Any help appreciated.
It is likely a gzipped cpio file. Try cpio -i < whatever.ngz. It will automatically recognize the gzip compression and decompress it, as well as extract the archive. cpio -oz < list > archive.ngz will make a new archive given the list of files in list.
Related
I need to compress the all of the contents of a directory into a single lz4 archive, i couldn't figure out a way to do that. I already have read all the available parameters, still no success. Kindly suggest me how can i achieve this.
Things like lz4, gzip, bzip2, and xz simply compress a stream of bytes. You need another utility, like tar, to convert a set of directories and files into a stream of bytes. The output of tar is then fed to the compressor. That's why you see archives with names like tar.gz or tar.xz.
How to use tar with lz4?
I am trying to compress a folder with Brotli(0.5.2) command line on Ubuntu 15.10
~/brotli-0.5.2$ ./bro -f -i ./dec/ -o folder.br
Then get error message:
failed to read input
Does anyone know how to compress folder with brotli?
Thanks.
brotli can only compress a file or a single stream of data. Just like gzip, xz, lzip, etc. To compress a directory, you would do what all archivers do, which is to convert the information in the directory into a single stream of data and write that to a file.
You did not provide a clue to your operating system in the question or tags, but on Unix-like systems, tar is used to take a directory and all of its contents in files, subdirectories, symbolic links, etc., and convert those to a single stream of data. Then you can use bro on that, as you would use any other compressor gzip, xz, etc. on it.
I have seen the example in valadoc.com for one file, but is any way to compress a list of files into only compressed package?
Thanks.
GZip does not support doing that. You probably want to make a tar archive which is then compressed with gzip. In that case, use libarchive, for which there are Vala bindings.
I need compress library for following needs:
1) Packing directory in one file with extension of my choice ( .pack for example )
2) Work with content in this file (directory) without unpaking it
3) Mechanism for encrypting
I already know about zlib, but for me it is ugly documented and not written anywhere what features are support from it
Packing directory in one file with extension of my choice ( .pack for example )
Most archivers don't require you to use a particular file extension. Regardless, one can still invoke file on a file to guess its content type.
Work with content in this file (directory) without unpaking it
It's possible to create a file list manually and prepend any archive file with that. Often, .sh installers for Linux contain a shell script in the beginning, followed by some magic line like __ARCHIVE_START__ followed by a binary archive. Hence it is possible to read lines from a file until __ARCHIVE_START__ line has been read. The rest of the file is an archive file.
Mechanism for encrypting
One easy way is to use different libraries for archiving and encrypting:
Bundle the files into one .tar.
Archive .tar into say .tar.xz.
Prepend the .tar.xz with file list followed by __ARCHIVE_START__ line.
Encrypt the file with any encryption library you please.
What you want is not a compression library. You want a compression, archiving, and encryption library or libraries. You need archiving to put a directory of files into a single file.
You can use zlib to do the compress part, but not archive or encrypt. zlib is documented in zlib.h and you can see a usage example there, as well as many examples in the source distribution package.
You can construct your own archiving format, or you can use existing ones for which there are libraries such as zip or tar, both of which use or can be directed to use zlib.
You can use OpenSSL for strong encryption.
If I have a folder with a bunch of images, how can I tar ONLY the images and not the folder structure leading to the images without having to CD into the directory of images?
tar czf images.tgz /path/to/images/*
Now when images.tgz is extracted, the contents that are extracted are /path/to/images/...
How I can only have the images included into the tgz file (and not the three folders that lead to the images)?
I know you can use --strip-components when untarring although I'm not sure if this would also work when creating.
Perhaps iterate through a folder structure and then pipe the results via stdout/stdin to tar sequentially? (with cat or similar?) IANA Linux Expert so afraid I can only theorise versus provide hard code at this second, you've got me wondering now though...