Javascript では、window.atob()
メソッドはbase64文字列をデコードし、window.btoa()
メソッドは a をbase64string
にエンコードします。
base64Decode()
では、なぜや のように名前が付けられなかったのでしょうかbase64Encode()
。atob()
また、btoa()
はまったく意味をなさないので意味をなさないのです。
理由を知りたいです。
ベストアンサー1
私尋ねたブレンダン・アイク(クリエイターJavaScript の開発者である彼が Twitter でこれらの名前を選んだら、次のように返信した。
古いUnixの名前、現在マニュアルページを見つけるのは難しいですが、https://www.unix.com/man-page/minix/1/btoa/…. 名前は Unix から Netscape のコードベースに引き継がれました。私は 1995 年に (5 月の 10 日後ですが、すぐに) 急いでそれらを JS に反映しました。
Minix リンクが壊れた場合に備えて、man ページの内容を以下に示します。
BTOA(1) BTOA(1)
NAME
btoa - binary to ascii conversion
SYNOPSIS
btoa [-adhor] [infile] [outfile]
OPTIONS
-a Decode, rather than encode, the file
-d Extracts repair file from diagnosis file
-h Help menu is displayed giving the options
-o The obsolete algorithm is used for backward compatibility
-r Repair a damaged file
EXAMPLES
btoa <a.out >a.btoa # Convert a.out to ASCII
btoa -a <a.btoa >a.out
# Reverse the above
DESCRIPTION
Btoa is a filter that converts a binary file to ascii for transmission over a telephone
line. If two file names are provided, the first in used for input and the second for out-
put. If only one is provided, it is used as the input file. The program is a function-
ally similar alternative to uue/uud, but the encoding is completely different. Since both
of these are widely used, both have been provided with MINIX. The file is expanded about
25 percent in the process.
SEE ALSO
uue(1), uud(1).