Skip to content

Instantly share code, notes, and snippets.

@meineerde
Created August 31, 2010 10:12
Show Gist options
  • Select an option

  • Save meineerde/558832 to your computer and use it in GitHub Desktop.

Select an option

Save meineerde/558832 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# run me like ruby binary.rb /PATH/TO/FILE
# this scripts checks if the file contains binary or textual data.
require 'yaml'
FILENAME = ARGV[0]
binary = File.read(FILENAME).is_binary_data?
puts "The file #{FILENAME} contains #{binary ? "BINARY" : "TEXTUAL"} data."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment