tar

python tar file how to extract file into stream

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to extract a zipped folder but instead of directly using .extractall() , I want to extract the file into stream so that I can handle the stream myself. Is it possible to do it using tarfile ? Or is there any suggestions? 回答1: You can obtain each file from a tar file as a python file object using the .extractfile() method. Loop over the tarfile.TarFile() instance to list all entries: import tarfile with tarfile.open(path) as tf: for entry in tf: # list each entry one by one fileobj = tf.extractfile(entry) # fileobj is now an open

How to create a tar.gz file in R?

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would create a tar.gz file from R. But the tar function doesn't work me. This is my example code. writeLines('aaaa', 'tmp.txt') tar('tmp.tar.gz', 'tmp.txt', compression = 'gzip') This code creates a tmp.tar.gz, but tmp.txt doesn't include in the gz file. Are there any mistakes in my code? Thanks for any suggestions. I run this code in windows and linux: #Windows platform sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 [3] LC

Gzip/TAR libraries for Javascript

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I would like to know this please, I am aware of some libraries that will access zip files but I would like to do this with tar files. Thank You 回答1: Take a look at this article Parsing tarballs with JavaScript 转载请标明出处: Gzip/TAR libraries for Javascript 文章来源: Gzip/TAR libraries for Javascript

How to fix NPM package Tar, with high vulnerability about Arbitrary File Overwrite, when package is up to date?

眉间皱痕 提交于 2019-12-03 06:30:32
问题 I just installed Flickity from NPM and got an NPM Audit Security Report after running npm audit stating that I have a high vulnerability issue regarding Arbitrary File Overwrite on package tar which is a dependency of node-sass as you can see here: High......................... Arbitrary File Overwrite Package...................... tar Patched in................... >=4.4.2 Dependency of................ node-sass [dev] Path......................... node-sass > node-gyp > tar More info.........

How to extract tar archive from stdin?

孤人 提交于 2019-12-03 06:30:18
问题 I have a large tar file I split . Is it possible to cat and untar the file using pipeline. Something like: cat largefile.tgz.aa largefile.tgz.ab | tar -xz instead of: cat largefile.tgz.aa largfile.tgz.ab > largefile.tgz tar -xzf largefile.tgz I have been looking around and I can't find the answer. I wanted to see if it was possible. 回答1: Use - as the input file: cat largefile.tgz.aa largefile.tgz.ab | tar zxf - Make sure you cat them in the same order they were split. If you're using zsh you

Deleting files after adding to tar archive

末鹿安然 提交于 2019-12-03 06:29:22
问题 Can GNU tar add many files to an archive, deleting each one as it is added? This is useful when there is not enough disk space to hold both the entire tar archive and the original files - and therefore it is not possible to simply manually delete the files after creating an archive in the usual way. 回答1: With GNU tar, use the option --remove-files . 回答2: I had a task - archive files and then remove into OS installed "tar" without GNU-options. Method: Use "xargs" Suppose, we are have a

Golang read from pipe reads tons of data

我怕爱的太早我们不能终老 提交于 2019-12-03 05:59:16
问题 I'm trying to read an archive that's being tarred, streaming, to stdin, but I'm somehow reading far more data in the pipe than tar is sending. I run my command like this: tar -cf - somefolder | ./my-go-binary The source code is like this: package main import ( "bufio" "io" "log" "os" ) // Read from standard input func main() { reader := bufio.NewReader(os.Stdin) // Read all data from stdin, processing subsequent reads as chunks. parts := 0 for { parts++ data := make([]byte, 4<<20) // Read 4MB

How to compare two tarball's content

落爺英雄遲暮 提交于 2019-12-03 05:34:14
问题 I want to tell whether two tarball files contain identical files, in terms of file name and file content, not including meta-data like date, user, group. However, There are some restrictions: first, I have no control of whether the meta-data is included when making the tar file, actually, the tar file always contains meta-data, so directly diff the two tar files doesn't work. Second, since some tar files are so large that I cannot afford to untar them in to a temp directory and diff the

Issues uncompressing a tar.gz file

天大地大妈咪最大 提交于 2019-12-03 05:20:34
I have been trying to uncompress the following file: sudo wget http://download.oracle.com/otn-pub/java/jdk/7u21-b11/jdk-7u21-linux-x64.tar.gz with the following: sudo tar zxvf jdk-7u21-linux-x64.tar.gz -C /usr/lib/jvm/ I am getting this error gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now I am using an Amazon Linux instances. By default jre is installed instead of the jdk, which I need to be able to run jboss. I would install the jdk using yum , but unfortunately it doesn't seem to be possible. Issue I am having is that it doesn't make

tar: Error is not recoverable: exiting now

不打扰是莪最后的温柔 提交于 2019-12-03 04:39:02
when I untar doctrine -rw-r--r-- 1 root root 660252 2010-10-16 23:06 Doctrine-1.2.0.tgz I always get this error messages root@X100e:/usr/local/lib/Doctrine/stable# tar -xvzf Doctrine-1.2.0.tgz . . . Doctrine-1.2.0/tests/ViewTestCase.php Doctrine-1.2.0/CHANGELOG gzip: stdin: decompression OK, trailing garbage ignored Doctrine-1.2.0/COPYRIGHT Doctrine-1.2.0/LICENSE tar: Child returned status 2 tar: Error is not recoverable: exiting now The untar operation works, but I always get this error messages. Any clues what I do wrong? I would try to unzip and untar separately and see what happens: mv