我如何使用Perl的Archive :: Tar压缩大于物理内存的文件? [英] How can I tar files larger than physical memory using Perl's Archive::Tar?
问题描述
我正在使用Perl的 Archive :: Tar 模块.它的问题是它将所有内容都拉到内存上并进行归档,然后再写到文件系统上,因此对可以归档的最大文件大小有限制.大多数情况下,它表明内存不足.如果是GNU tar,它将获取文件的一部分,将其归档并将其写入内存,以便它可以处理任何大小的文件.如何使用Perl的Archive :: Tar模块做到这一点.
I'm using Perl's Archive::Tar module. Problem with it is it pulls everything on to the memory and the does archiving and then writes on to the file system so there is limitation on the maximum file size that can be archived. Most of the times it says out of memory. In case of GNU tar, it takes chunk of file, archives it and writes it on to the memory so it can handle files of any size. How can I do that using Perl's Archive::Tar module.
推荐答案
It looks like there is a different module that doesn't use an in-memory structure: Archive::Tar::Streamed. The downside is that it requires tar to be available on the system it is run on. Still, it is better than puppet-stringing tar yourself.
这篇关于我如何使用Perl的Archive :: Tar压缩大于物理内存的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!