Sha256: 5d55f1f78e67c63af3be875f8082c1eb6c80ff3c7f06596e8460038507c91fd8

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

= SixArm.com » Ruby » MagicNumberType

Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com
Copyright:: Copyright (c) 2010 Joel Parker Henderson
License:: See LICENSE.txt file

MagicNumberType infers the mime type of data from the leading bits.

It infers based on widespread programming conventions for data file formats.

Magic numbers are the first bits of a file or data stream
which uniquely identify the type of file or data stream.

For example when the first bits are "BM",
this identifies the file as a bitmap image file.

These magic numbers are by convention and we are using this guide:
http://www.astro.keele.ac.uk/oldusers/rno/Computing/File_magic.html

Typical uses of magic numbers:
  - to quickly identify a file's data type
  - to check if data matches the file's MIME type or extension
  - to check if a web form file upload matches its HTTP content type

Compare:
  - MIME::Types ruby library 
  - Unix magic() command for testing files on disk
  - http://shared-mime.rubyforge.org/

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sixarm_ruby_magic_number_type-1.0.0 README.rdoc