0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Macでjsonファイルに対して、base64ができない(base64: invalid argument xxx.json)

Posted at

はじめに

瑣末なことで少しはまったので、メモします。

問題

jsonファイルに対して、base64ができない。
以下エラーが出る。

base64: invalid argument xxx.json

lsコマンドでディレクトリにファイルがあることを確認

ユーザー名@MacBook-Air ディレクトリ名 % ls
xxx.json

base64コマンドを実行するも、エラーになる。

ユーザー名@MacBook-Air ディレクトリ名 % base64 xxx.json
base64: invalid argument xxx.json
Usage:	base64 [-hDd] [-b num] [-i in_file] [-o out_file]
  -h, --help     display this message
  -Dd, --decode   decodes input
  -b, --break    break encoded string into num character lines
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)

解決方法

フルパスで解決することができた。

% base64 -i /Users/ユーザー名/ディレクトリ/ディレクトリ/xxx.json | pbcopy

ただ、コマンドとエラー内容を良くみたら「-i」というオプションコマンドが必要だった様子。

おわりに

Chatgptに頼りすぎは良くないと思いました。
エラー内容、説明を良くみるようにします。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?