split_file_ultra 0.0.1

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/split_file_ultra.rb +16 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4a7c6aaa49466b4d982744ecdf0ab6168311e78d
4
+ data.tar.gz: ab8b52d2004640645da6be52400ae6bfb915463c
5
+ SHA512:
6
+ metadata.gz: d701a2157f60021048fcd2bec7b2b2c39c2cca8e6cb6dfce0db107751c359507ea5df65d02216ff76c88d16b22ca4421b9abced287c045de0724420fba909010
7
+ data.tar.gz: 233c2c67ad3eb3be725a43bdd7f3d091ff41e96bc9feaba27b6c45af91f4ff7dc8e6e80a212143f010d12ee359e65d08437b920d13116a1bb8819fe27bf74325
@@ -0,0 +1,16 @@
1
+ # Just split it!
2
+ class SplitFileUltra
3
+ def self.split(f_in, chunksize = 1024 * 1024)
4
+ chunks_list = []
5
+ File.open(f_in, 'r') do |fh_in|
6
+ until fh_in.eof?
7
+ chunk_name = "#{File.dirname(f_in)}/#{(File.basename(f_in).split('.')[0..-2]).join}.#{fh_in.pos / chunksize}#{File.extname(f_in)}"
8
+ File.open(chunk_name, 'w') do |fh_out|
9
+ fh_out << fh_in.read(chunksize)
10
+ end
11
+ chunks_list << chunk_name
12
+ end
13
+ end
14
+ chunks_list
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: split_file_ultra
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - iamsimakov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-03-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Simple gem for spliting any files.
14
+ email: iamsimakov@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/split_file_ultra.rb
20
+ homepage: https://github.com/iamsimakov/split_file_ultra
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.2
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Split any files
44
+ test_files: []