file_signature 1.1.0

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.
data/.gemtest ADDED
File without changes
data/README.md ADDED
@@ -0,0 +1,81 @@
1
+ * Repo: <http://github.com/robacarp/file_signature>
2
+ * Email: Robert Carpenter, <coder@robacarp.com>
3
+ * Email: Joel Parker Henderson, <joel@sixarm.com>
4
+
5
+ ## Introduction
6
+
7
+
8
+ Magic numbers are the first bits of a file or data stream which uniquely identify the type of file or data stream.
9
+
10
+ For example when the first bits are "BM", this identifies the file as a bitmap image file.
11
+
12
+ For docs go to <http://sixarm.com/sixarm_ruby_magic_number_type/doc>
13
+
14
+ Want to help? We're happy to get pull requests.
15
+
16
+
17
+ ## Install quickstart
18
+
19
+ Install:
20
+
21
+ gem install file_signature
22
+
23
+ Bundler:
24
+
25
+ gem "file_signature", "~>1.0.0"
26
+
27
+ Require:
28
+
29
+ require "file_signature"
30
+
31
+ ## Details
32
+
33
+ This gem infers based on widespread programming conventions for data file formats.
34
+
35
+ These magic numbers are by convention and we are using this guide: http://www.astro.keele.ac.uk/oldusers/rno/Computing/File_magic.html
36
+
37
+ Typical uses of magic numbers:
38
+
39
+ * quickly guess at a file's mime type
40
+ * check if data matches the file's MIME type or extension
41
+ * check if a web form file upload matches its HTTP content type
42
+
43
+ Compare:
44
+
45
+ * MIME::Types ruby library
46
+ * Unix magic() command for testing files on disk
47
+ * http://shared-mime.rubyforge.org/
48
+
49
+
50
+ ## Changes
51
+
52
+ * 2012-03-14 1.0.0 Update docs, tests
53
+ * 2012-05-31 1.1.0 Add memo, reformat and rename things for clarity
54
+
55
+ ## License
56
+
57
+ You may choose any of these open source licenses:
58
+
59
+ * Apache License
60
+ * BSD License
61
+ * CreativeCommons License, Non-commercial Share Alike
62
+ * GNU General Public License Version 2 (GPL 2)
63
+ * GNU Lesser General Public License (LGPL)
64
+ * MIT License
65
+ * Perl Artistic License
66
+ * Ruby License
67
+
68
+ The software is provided "as is", without warranty of any kind,
69
+ express or implied, including but not limited to the warranties of
70
+ merchantability, fitness for a particular purpose and noninfringement.
71
+
72
+ In no event shall the authors or copyright holders be liable for any
73
+ claim, damages or other liability, whether in an action of contract,
74
+ tort or otherwise, arising from, out of or in connection with the
75
+ software or the use or other dealings in the software.
76
+
77
+ This license is for the included software that is created by SixArm;
78
+ some of the included software may have its own licenses, copyrights,
79
+ authors, etc. and these do take precedence over the SixArm license.
80
+
81
+ Copyright (c) 2005-2012 Joel Parker Henderson
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'lib' << 'test'
7
+ t.pattern = 'test/*.rb'
8
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.1.0
@@ -0,0 +1,124 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ class IO
7
+
8
+ # We implement magic by using a lookup hash.
9
+ # The key is a string that encodes the first bits.
10
+ # The value is a symbol that indicates the magic type.
11
+ #
12
+ # Examples:
13
+ # IO::MagicNumberType("BM") => :bitmap
14
+ # IO::MagicNumberType("GIF8") => :gif
15
+ # IO::MagicNumberType("\xa6\x00") => :pgp_encrypted_data
16
+ #
17
+ # Quirks:
18
+ # - JPEG adjustment:
19
+ # - Some cameras put JPEG Exif data in bytes 3 & 4,
20
+ # so we only check the first two bytes of a JPEG.
21
+ # - TIFF has two possible matches:
22
+ # - MM** is Motorola big endian
23
+ # - II** is Intel little ending
24
+ #
25
+ # See:
26
+ # - IO#magic_number_type
27
+ # - File.magic_number_type
28
+
29
+ SignatureMap = {
30
+ "BC" => :bitcode,
31
+ "BM" => :bitmap,
32
+ "BZ" => :bzip,
33
+ "MZ" => :exe,
34
+ "SIMPLE"=> :fits,
35
+ "GIF8" => :gif,
36
+ "GKSM" => :gks,
37
+ [0x01,0xDA].pack('c*') => :iris_rgb,
38
+ [0xF1,0x00,0x40,0xBB].pack('c*') => :itc,
39
+ [0xFF,0xD8].pack('c*') => :jpeg,
40
+ "IIN1" => :niff,
41
+ "MThd" => :midi,
42
+ "%PDF" => :pdf,
43
+ "VIEW" => :pm,
44
+ [0x89].pack('c*') + "PNG" => :png,
45
+ "%!" => :postscript,
46
+ "Y" + [0xA6].pack('c*') + "j" + [0x95].pack('c*') => :sun_rasterfile,
47
+ "MM*" + [0x00].pack('c*') => :tiff,
48
+ "II*" + [0x00].pack('c*') => :tiff,
49
+ "gimp xcf" => :gimp_xcf,
50
+ "#FIG" => :xfig,
51
+ "/* XPM */" => :xpm,
52
+ [0x23,0x21].pack('c*') => :shebang,
53
+ [0x1F,0x9D].pack('c*') => :compress,
54
+ [0x1F,0x8B].pack('c*') => :gzip,
55
+ "PK" + [0x03,0x04].pack('c*') => :pkzip,
56
+ "MZ" => :dos_os2_windows_executable,
57
+ ".ELF" => :unix_elf,
58
+ [0x99,0x00].pack('c*') => :pgp_public_ring,
59
+ [0x95,0x01].pack('c*') => :pgp_security_ring,
60
+ [0x95,0x00].pack('c*') => :pgp_security_ring,
61
+ [0xA6,0x00].pack('c*') => :pgp_encrypted_data,
62
+ [0xD0,0xCF,0x11,0xE0].pack('c*') => :docfile
63
+ }
64
+
65
+ SignatureSize = SignatureMap.keys.inject(0){ |m,k| k.length > m ? k.length : m }
66
+
67
+
68
+ # Detect the data type by checking various "magic number" conventions
69
+ # for the introductory bytes of a data stream
70
+ #
71
+ # Return the "magic number" as a symbol:
72
+ # - :bitmap = Bitmap image file, typical extension ".bmp"
73
+ # - :gzip = Unix GZIP compressed data, typical extension ".gz"
74
+ # - :postscript = Postscript pages, typical extension ".ps"
75
+ #
76
+ # Return nil if there's no match for any known magic number.
77
+ #
78
+ # Example:
79
+ # f = File.open("test.ps","rb")
80
+ # put f.magic_number(s)
81
+ # => :postscript
82
+ #
83
+ # See:
84
+ # - IO::MagicNumberTypeHash
85
+ # - File.magic_number_type
86
+
87
+ def magic_number_type
88
+ return @magic_number_memo if defined? @magic_number_memo
89
+
90
+ bytes = ""
91
+ type = nil
92
+
93
+ while bytes.size < SignatureSize
94
+ bytes += read(1)
95
+ type = SignatureMap[bytes]
96
+ break if type
97
+ end
98
+
99
+ @magic_number_memo = type
100
+ end
101
+
102
+ end
103
+
104
+
105
+ class File
106
+
107
+ # Detect the file's data type by opening the file then
108
+ # using IO#magic_number_type to read the first bits.
109
+ #
110
+ # Return a magic number type symbol, e.g. :bitmap, :jpg, etc.
111
+ #
112
+ # Example:
113
+ # puts File.magic_number_type("test.ps") => :postscript
114
+ #
115
+ # See
116
+ # - IO#MagicNumberTypeHash
117
+ # - IO#magic_number_type
118
+
119
+ def self.magic_number_type(file_name)
120
+ File.open(file_name,"rb"){|f| f.magic_number_type }
121
+ end
122
+
123
+ end
124
+
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,348 @@
1
+ %!PS-Adobe-3.0
2
+ %%Creator: GIMP PostScript file plugin V 1.17 by Peter Kirchgessner
3
+ %%Title: sample.ps
4
+ %%CreationDate: Sun Feb 6 22:49:17 2011
5
+ %%DocumentData: Clean7Bit
6
+ %%LanguageLevel: 2
7
+ %%Pages: 1
8
+ %%BoundingBox: 14 14 115 115
9
+ %%EndComments
10
+ %%BeginProlog
11
+ % Use own dictionary to avoid conflicts
12
+ 10 dict begin
13
+ %%EndProlog
14
+ %%Page: 1 1
15
+ % Translate for offset
16
+ 14.173228346456694 14.173228346456694 translate
17
+ % Translate to begin of first scanline
18
+ 0 99.999999999999986 translate
19
+ 99.999999999999986 -99.999999999999986 scale
20
+ % Image geometry
21
+ 100 100 8
22
+ % Transformation matrix
23
+ [ 100 0 0 100 0 0 ]
24
+ % Strings to hold RGB-samples per scanline
25
+ /rstr 100 string def
26
+ /gstr 100 string def
27
+ /bstr 100 string def
28
+ {currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop}
29
+ {currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop}
30
+ {currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop}
31
+ true 3
32
+ %%BeginData: 3724 ASCII Bytes
33
+ colorimage
34
+ SHaT~>
35
+ Sc=3~>
36
+ SH+0~>
37
+ SHaT~>
38
+ Sc=3~>
39
+ SH+0~>
40
+ SHaT~>
41
+ Sc=3~>
42
+ SH+0~>
43
+ SHaT~>
44
+ Sc=3~>
45
+ SH+0~>
46
+ SHaT~>
47
+ Sc=3~>
48
+ SH+0~>
49
+ SHaT~>
50
+ Sc=3~>
51
+ SH+0~>
52
+ SHaT~>
53
+ Sc=3~>
54
+ SH+0~>
55
+ SHaT~>
56
+ Sc=3~>
57
+ SH+0~>
58
+ SHaT~>
59
+ Sc=3~>
60
+ SH+0~>
61
+ SHaT~>
62
+ Sc=3~>
63
+ SH+0~>
64
+ SHaT~>
65
+ Sc=3~>
66
+ SH+0~>
67
+ SHaT~>
68
+ Sc=3~>
69
+ SH+0~>
70
+ SHaT~>
71
+ Sc=3~>
72
+ SH+0~>
73
+ SHaT~>
74
+ Sc=3~>
75
+ SH+0~>
76
+ SHaT~>
77
+ Sc=3~>
78
+ SH+0~>
79
+ SHaT~>
80
+ Sc=3~>
81
+ SH+0~>
82
+ SHaT~>
83
+ Sc=3~>
84
+ SH+0~>
85
+ SHaT~>
86
+ Sc=3~>
87
+ SH+0~>
88
+ SHaT~>
89
+ Sc=3~>
90
+ SH+0~>
91
+ SHaT~>
92
+ Sc=3~>
93
+ SH+0~>
94
+ SHaT~>
95
+ Sc=3~>
96
+ SH+0~>
97
+ SHaT~>
98
+ Sc=3~>
99
+ SH+0~>
100
+ SHaT~>
101
+ Sc=3~>
102
+ SH+0~>
103
+ SHaT~>
104
+ Sc=3~>
105
+ SH+0~>
106
+ SHaT~>
107
+ Sc=3~>
108
+ SH+0~>
109
+ SHaT~>
110
+ Sc=3~>
111
+ SH+0~>
112
+ SHaT~>
113
+ Sc=3~>
114
+ SH+0~>
115
+ SHaT~>
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c++~>
191
+ SH+0~>
192
+ pBLBm!!W?+!!E-!!!<-"rW`?%rW`?%rW`?%r<E6$!!<&u!!3''rW)p%!!DurnHOL~>
193
+ p]($h!=?jHrr?j4!!$@)!<3#t!<3#t!<3#t!<)rs!!$U.!!>@[s8W&urr2t>p]0jaJ,~>
194
+ SH+0~>
195
+ pBC[%!Wi9#!W`?+r!!<,!<<-&#6"W%#6"W%#6"W%#6"W$#6"T+"p4l+!<`9)rW)m$#R(81!!!$#
196
+ !sS3!J,~>
197
+ p\tMl@5&;r#9dL*rVm)uINJ_8IJa!Drr;rtrr;rtrr;rtrVuis#5sH+"s8*_rr;rtrVm/@>pBXY
198
+ (I*>qnc++~>
199
+ SH+0~>
200
+ ap.hFf*6a~>
201
+ b5_G@fDg@~>
202
+ SH+0~>
203
+ ap.hFf*6a~>
204
+ b5_G@fDg@~>
205
+ SH+0~>
206
+ ap.hFf*6a~>
207
+ b5_G@fDg@~>
208
+ SH+0~>
209
+ ap.hFf*6a~>
210
+ b5_G@fDg@~>
211
+ SH+0~>
212
+ SHaT~>
213
+ Sc=3~>
214
+ SH+0~>
215
+ SHaT~>
216
+ Sc=3~>
217
+ SH+0~>
218
+ SHaT~>
219
+ Sc=3~>
220
+ SH+0~>
221
+ SHaT~>
222
+ Sc=3~>
223
+ SH+0~>
224
+ SHaT~>
225
+ Sc=3~>
226
+ SH+0~>
227
+ SHaT~>
228
+ Sc=3~>
229
+ SH+0~>
230
+ SHaT~>
231
+ Sc=3~>
232
+ SH+0~>
233
+ SHaT~>
234
+ Sc=3~>
235
+ SH+0~>
236
+ SHaT~>
237
+ Sc=3~>
238
+ SH+0~>
239
+ SHaT~>
240
+ Sc=3~>
241
+ SH+0~>
242
+ SHaT~>
243
+ Sc=3~>
244
+ SH+0~>
245
+ SHaT~>
246
+ Sc=3~>
247
+ SH+0~>
248
+ SHaT~>
249
+ Sc=3~>
250
+ SH+0~>
251
+ SHaT~>
252
+ Sc=3~>
253
+ SH+0~>
254
+ SHaT~>
255
+ Sc=3~>
256
+ SH+0~>
257
+ SHaT~>
258
+ Sc=3~>
259
+ SH+0~>
260
+ SHaT~>
261
+ Sc=3~>
262
+ SH+0~>
263
+ SHaT~>
264
+ Sc=3~>
265
+ SH+0~>
266
+ SHaT~>
267
+ Sc=3~>
268
+ SH+0~>
269
+ SHaT~>
270
+ Sc=3~>
271
+ SH+0~>
272
+ SHaT~>
273
+ Sc=3~>
274
+ SH+0~>
275
+ SHaT~>
276
+ Sc=3~>
277
+ SH+0~>
278
+ SHaT~>
279
+ Sc=3~>
280
+ SH+0~>
281
+ SHaT~>
282
+ Sc=3~>
283
+ SH+0~>
284
+ SHaT~>
285
+ Sc=3~>
286
+ SH+0~>
287
+ SHaT~>
288
+ Sc=3~>
289
+ SH+0~>
290
+ SHaT~>
291
+ Sc=3~>
292
+ SH+0~>
293
+ SHaT~>
294
+ Sc=3~>
295
+ SH+0~>
296
+ SHaT~>
297
+ Sc=3~>
298
+ SH+0~>
299
+ SHaT~>
300
+ Sc=3~>
301
+ SH+0~>
302
+ SHaT~>
303
+ Sc=3~>
304
+ SH+0~>
305
+ SHaT~>
306
+ Sc=3~>
307
+ SH+0~>
308
+ SHaT~>
309
+ Sc=3~>
310
+ SH+0~>
311
+ SHaT~>
312
+ Sc=3~>
313
+ SH+0~>
314
+ SHaT~>
315
+ Sc=3~>
316
+ SH+0~>
317
+ SHaT~>
318
+ Sc=3~>
319
+ SH+0~>
320
+ SHaT~>
321
+ Sc=3~>
322
+ SH+0~>
323
+ SHaT~>
324
+ Sc=3~>
325
+ SH+0~>
326
+ SHaT~>
327
+ Sc=3~>
328
+ SH+0~>
329
+ SHaT~>
330
+ Sc=3~>
331
+ SH+0~>
332
+ SHaT~>
333
+ Sc=3~>
334
+ SH+0~>
335
+ SHaT~>
336
+ Sc=3~>
337
+ SH+0~>
338
+ SHaT~>
339
+ Sc=3~>
340
+ SH+0~>
341
+ SHaT~>
342
+ Sc=3~>
343
+ SH+0~>
344
+ %%EndData
345
+ showpage
346
+ %%Trailer
347
+ end
348
+ %%EOF
Binary file
Binary file
@@ -0,0 +1,48 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # to run test:
4
+ # - gem install minitest
5
+ # - from gem root directory:
6
+ # - `ruby test/file_signature_test.rb`
7
+ #
8
+
9
+ $LOAD_PATH << File.expand_path("#{File.dirname(__FILE__)}/../lib")
10
+
11
+ require 'minitest/autorun'
12
+ require 'file_signature'
13
+
14
+ describe File do
15
+
16
+ FILE_TO_MAGIC_NUMBER_MAP = {
17
+ 'sample.fit' => :fits,
18
+ 'sample.gif' => :gif,
19
+ 'sample.jpg' => :jpeg,
20
+ 'sample.png' => :png,
21
+ 'sample.ps' => :postscript,
22
+ 'sample.ras' => :sun_rasterfile,
23
+ 'sample.sgi' => :iris_rgb,
24
+ 'sample.tiff' => :tiff,
25
+ 'sample.xcf.bz2' => :bzip,
26
+ 'sample.xcf.gz' => :gzip,
27
+ }
28
+
29
+ FILE_TO_MAGIC_NUMBER_MAP.each_pair do |file_name, type|
30
+ path = File.join("test","file_signature_test",file_name)
31
+
32
+ it "guesses the expected magic number type by filename and path for #{type.to_s}" do
33
+ File.magic_number_type(path).must_equal type
34
+ end
35
+
36
+ f = File.open(path)
37
+
38
+ it "when called from an IO object for #{type.to_s}" do
39
+ f.magic_number_type.must_equal type
40
+ end
41
+
42
+ it "when called from an IO object...a second time for #{type.to_s}" do
43
+ #test it twice for the memo
44
+ f.magic_number_type.must_equal type
45
+ end
46
+
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: file_signature
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - robacarp
9
+ - SixArm
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-05-31 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description: Monkeypatches File and IO to include a '''magic_number_type''' method
16
+ which returns a symbol representing the mime type guessed based off of the first
17
+ few bytes of a file.
18
+ email: coder@robacarp.com
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - .gemtest
24
+ - Rakefile
25
+ - README.md
26
+ - VERSION
27
+ - lib/file_signature.rb
28
+ - test/file_signature_test.rb
29
+ - test/file_signature_test/sample.fit
30
+ - test/file_signature_test/sample.gif
31
+ - test/file_signature_test/sample.jpg
32
+ - test/file_signature_test/sample.png
33
+ - test/file_signature_test/sample.ps
34
+ - test/file_signature_test/sample.ras
35
+ - test/file_signature_test/sample.sgi
36
+ - test/file_signature_test/sample.tiff
37
+ - test/file_signature_test/sample.xcf.bz2
38
+ - test/file_signature_test/sample.xcf.gz
39
+ homepage: http://robacarp.com
40
+ licenses: []
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 1.8.22
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: File signature adds the ability to inspect the first few bytes of a file
63
+ to guess at mime-type.
64
+ test_files:
65
+ - test/file_signature_test.rb
66
+ - test/file_signature_test/sample.fit
67
+ - test/file_signature_test/sample.gif
68
+ - test/file_signature_test/sample.jpg
69
+ - test/file_signature_test/sample.png
70
+ - test/file_signature_test/sample.ps
71
+ - test/file_signature_test/sample.ras
72
+ - test/file_signature_test/sample.sgi
73
+ - test/file_signature_test/sample.tiff
74
+ - test/file_signature_test/sample.xcf.bz2
75
+ - test/file_signature_test/sample.xcf.gz