Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use strict;
- use warnings;
- use File::MimeInfo::Magic;
- @File::MimeInfo::DIRS = qw(/usr/local/share/mime/);
- File::MimeInfo->rehash();
- use URI;
- my $input_file = $ARGV[0];
- unless ($input_file) {
- while (<DATA>){
- print STDERR $_;
- }
- exit 1;
- }
- my $mime_type = mimetype($input_file);
- my $url = URI->new("data:");
- $url->media_type($mime_type);
- $url->data(scalar(`cat $input_file`));
- print "\n$url\n";
- __DATA__
- dataurl
- command line tool for generate data-url scheme.
- Usage:
- dataurl [FILE]
Add Comment
Please, Sign In to add comment