blob: d30f2b437c67f2d16de76d016845e9076d0920ff [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{binhex} ---
Fred Drakebbac4321999-02-20 00:14:17 +00002 Encode and decode binhex4 files}
Fred Drakeb91e9341998-07-23 17:59:49 +00003
Fred Drakebbac4321999-02-20 00:14:17 +00004\declaremodule{standard}{binhex}
Fred Drakeb91e9341998-07-23 17:59:49 +00005\modulesynopsis{Encode and decode files in binhex4 format.}
6
Fred Drake1aabe5e1998-02-19 18:29:18 +00007
8This module encodes and decodes files in binhex4 format, a format
Fred Drakec37b65e2001-11-28 07:26:15 +00009allowing representation of Macintosh files in \ASCII. On the Macintosh,
Fred Drake1aabe5e1998-02-19 18:29:18 +000010both forks of a file and the finder information are encoded (or
11decoded), on other platforms only the data fork is handled.
12
Fred Drakefc576191998-04-04 07:15:02 +000013The \module{binhex} module defines the following functions:
Fred Drake1aabe5e1998-02-19 18:29:18 +000014
Fred Drakecce10901998-03-17 06:33:25 +000015\begin{funcdesc}{binhex}{input, output}
Fred Drake1aabe5e1998-02-19 18:29:18 +000016Convert a binary file with filename \var{input} to binhex file
17\var{output}. The \var{output} parameter can either be a filename or a
Fred Drake26f7cfe91999-04-23 15:41:53 +000018file-like object (any object supporting a \method{write()} and
19\method{close()} method).
Fred Drake1aabe5e1998-02-19 18:29:18 +000020\end{funcdesc}
21
Fred Drakecce10901998-03-17 06:33:25 +000022\begin{funcdesc}{hexbin}{input\optional{, output}}
Fred Drake1aabe5e1998-02-19 18:29:18 +000023Decode a binhex file \var{input}. \var{input} may be a filename or a
Fred Drake26f7cfe91999-04-23 15:41:53 +000024file-like object supporting \method{read()} and \method{close()} methods.
Fred Drake1aabe5e1998-02-19 18:29:18 +000025The resulting file is written to a file named \var{output}, unless the
Fred Drake26f7cfe91999-04-23 15:41:53 +000026argument is omitted in which case the output filename is read from the
Fred Drake1aabe5e1998-02-19 18:29:18 +000027binhex file.
28\end{funcdesc}
29
Fred Drake3787c9d2002-03-25 16:37:56 +000030The following exception is also defined:
31
32\begin{excdesc}{Error}
33Exception raised when something can't be encoded using the binhex
34format (for example, a filename is too long to fit in the filename
35field), or when input is not properly encoded binhex data.
36\end{excdesc}
37
Fred Drake26f7cfe91999-04-23 15:41:53 +000038
39\begin{seealso}
Fred Drakeba0a9892000-10-18 17:43:06 +000040 \seemodule{binascii}{Support module containing \ASCII-to-binary
41 and binary-to-\ASCII{} conversions.}
Fred Drake26f7cfe91999-04-23 15:41:53 +000042\end{seealso}
43
44
Fred Drakebbac4321999-02-20 00:14:17 +000045\subsection{Notes \label{binhex-notes}}
46
Fred Drake1aabe5e1998-02-19 18:29:18 +000047There is an alternative, more powerful interface to the coder and
48decoder, see the source for details.
49
50If you code or decode textfiles on non-Macintosh platforms they will
Fred Drakefc576191998-04-04 07:15:02 +000051still use the Macintosh newline convention (carriage-return as end of
Fred Drake1aabe5e1998-02-19 18:29:18 +000052line).
53
Fred Drakefc576191998-04-04 07:15:02 +000054As of this writing, \function{hexbin()} appears to not work in all
55cases.