From 227b7baff6fb0d417243450f19f6a3ad810ea06d Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 19 Jul 2011 16:42:05 +0200 Subject: util make-data-url: initial commit NAME make-data-url - create a "data" URL scheme item SYNOPSIS make-data-url [file...] DESCRIPTION The make-data-url is a best efforts generator of "data" URL scheme compatible items as described by RFC 2397. Each file is read, analyzed, and printed as single-lined "data" URL to stdout. OPERANDS The following operands shall be supported: file A pathname of a file. The content of each file is printed as single-lined "data" URL to the standard output. The mime-type of the file's content gets guessed by the file utility. STDIN None INPUT FILES Input files can be any file type. ENVIRONMENT VARIABLES The following environment variables shall affect the execution of make-data-url: None. ASYNCHRONOUS EVENTS Default. STDOUT Each line shall contain a "data" URL item for the respective file operand. STDERR The standard error shall be used only for diagnostic messages. OUTPUT FILES None. EXTENDED DESCRIPTION None. EXIT STATUS The following exit values shall be returned: 0 The program has terminated. CONSEQUENCES OF ERRORS Default. The following sections are informative APPLICATION USAGE Default. EXAMPLES Test your backup scheme: sudo rm -fR /home RATIONALE None. FUTURE DIRECTIONS None. SEE ALSO RFC 2397, file BUGS None, this is enterprise-grade software and behaves exactly as specified. AUTHOR KREBS COPYTIGHT Copytight (c) 2011, KREBS. This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more details. COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operatingg Systems Interface (POSIX), The Open Group Base Specification Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . Deal with it! --- util/bin/make-data-uri | 7 +++++++ util/bin/make-data-url | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100755 util/bin/make-data-uri create mode 100755 util/bin/make-data-url (limited to 'util/bin') diff --git a/util/bin/make-data-uri b/util/bin/make-data-uri new file mode 100755 index 00000000..a9d014e6 --- /dev/null +++ b/util/bin/make-data-uri @@ -0,0 +1,7 @@ +#! /bin/sh +set -euf +for path; do + type="`file -bi "$path"`" + data="`base64 -w 0 "$path"`" + echo "data:$type;base64,$data" +done diff --git a/util/bin/make-data-url b/util/bin/make-data-url new file mode 100755 index 00000000..a9d014e6 --- /dev/null +++ b/util/bin/make-data-url @@ -0,0 +1,7 @@ +#! /bin/sh +set -euf +for path; do + type="`file -bi "$path"`" + data="`base64 -w 0 "$path"`" + echo "data:$type;base64,$data" +done -- cgit v1.2.3