Ruby中的压缩和解压缩的使用
来源:互联网 发布:网络打鱼 编辑:程序博客网 时间:2024/05/01 08:47
直接上代码
#The following example opens zip archive my.zip (creating it if it doesn‘t exist) and adds an entry first.txt and a directory entry a_dir to it.gem 'rubyzip' require 'zip' Zip::File.open("test.zip", Zip::File::CREATE) { |zipfile| zipfile.get_output_stream("first.txt") { |f| f.puts "Hello from ZipFi2222222222le" } #zipfile.mkdir("a_dir") }#The next example reopens my.zip writes the contents of first.txt to standard out and deletes the entry from the archive. Zip::File.open("test.zip", Zip::File::CREATE) { |zipfile|zipfile.each do |zent|puts zent puts zipfile.read(zent) #zipfile.remove("first.txt")end }
可以参考的文档和下载ZIP包的路径:
http://rubyzip.sourceforge.net/
http://rubyzip.sourceforge.net/classes/Zip/ZipFile.html
http://sourceforge.net/projects/rubyzip/files/rubyzip/
0 0
- Ruby中的压缩和解压缩的使用
- 文件的压缩和解压缩
- 压缩和解压缩的方法
- 压缩和解压缩的类
- 字符串的压缩和解压缩
- urlno的压缩和解压缩
- 文件的压缩和解压缩
- zipfile的压缩和解压缩
- Linux的压缩和解压缩
- 使用Java实现文件的压缩和解压缩
- 使用Java实现文件的压缩和解压缩
- 使用Java实现文件的压缩和解压缩
- Java使用7Zip完成文件的压缩和解压缩
- Linux中的tar命令,压缩和解压缩
- 使用Zlib实现压缩和解压缩
- 使用Zlib实现压缩和解压缩
- tar 压缩和解压缩使用笔记
- IOS中使用SSZipArchive压缩和解压缩
- NYOJ NO.252 01串
- yum 禁止更新内核
- Android ListView 列表分隔,条目中添加分类信息(文字,图片等)
- NYOJ NO.289 苹果
- Codeforces Round #240 (Div. 2) ABCD简单解题报告
- Ruby中的压缩和解压缩的使用
- 浅谈 Python 程序和 C 程序的整合
- NOIP 2008第四题 双栈排序
- iOS百度地图开发笔记(一)
- (2013&2012Windows编程+网络编程)360、腾讯、迅雷面试题及答案
- ZOJ 2514
- Matlab以MEX方式调用C源代码
- Python快速学习01:Eclipse上配置PyDev & 'Hello World !'
- 交叉编译openssl