em-zipper 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 090d6b96a8c58be7a5dba0389f2db68619dc1730
4
- data.tar.gz: 01ad0f08255ac98a70ea7c8557647343a77228b6
3
+ metadata.gz: cc727f74fced2747964e208ae1ec001d672f26fa
4
+ data.tar.gz: 837304dea8ffb7568c0b820359f89d615ccb1054
5
5
  SHA512:
6
- metadata.gz: 2cebe78590e5e1d371eea8fce24ba67760f234658a4ea6d0bf0942a0a9facd31eddf0759f30998be7499e9a61bbcecaee742b9141c2a20cf887f877f6f6eb804
7
- data.tar.gz: 5b34d563fb5ad6a644892eacff1ae46f1abdc28dd7396812932406cc0c34336179eec28481dee2adaf10091cd6415ca5679a8746952e8e22c96308667e2bf544
6
+ metadata.gz: cb7f794cc055025fa377a42c2c9bf1110780f626511812f0a4671262ec98c6b0c7f368357d309013b610b3bc9527708a45b6aa5b1a2ec3a163fc9119dcc12e25
7
+ data.tar.gz: bee9cd5d524c65446229b7bcee7891cf787b10eaa8e3bba1569ff82210548463bcda71b65608f12b5da0abe1b106b4c8209fd27c649f9409a2984c263e97bef5
@@ -0,0 +1 @@
1
+ [Async Sinatra Example here](https://github.com/nowk/async-sinatra-em-zipper-example)
data/examples/file.rb CHANGED
@@ -4,17 +4,31 @@ require './lib/em-zipper'
4
4
  EM.run do
5
5
  EM.add_periodic_timer(1) { puts 'tick' } # tick tock
6
6
 
7
+
8
+ # file zip to file
9
+ #
7
10
  files = %w(sample1.txt sample2.txt).map do |file_name|
8
11
  File.join(File.expand_path("./examples/files"), file_name)
9
12
  end
10
13
 
11
- # zip to file
12
- #
13
- buff = File.new('file-non-blocking.zip', 'w')
14
+ fbuff = File.new('file-non-blocking.zip', 'w')
15
+ fzip = EM::Zipper.new(files, fbuff)
16
+ fzip.callback do |io|
17
+ puts 'File zipped from files'
18
+ end
14
19
 
15
- zippy = EM::Zipper.new(files, buff).zip!
16
- zippy.callback do |io|
17
- EM.stop
20
+
21
+ # http remotes to file
22
+ #
23
+ sites = %w(http://www.google.com/ https://www.github.com/)
24
+ rbuff = File.new('remotes-file-non-blocking.zip', 'w')
25
+ rzip = EM::Zipper.new(sites, rbuff)
26
+ rzip.callback do |io|
27
+ puts 'File zipped from remotes'
18
28
  end
29
+
30
+
31
+ fzip.zip!
32
+ rzip.zip!
19
33
  end
20
34