/File2Base64

Converts any type of file to base64 string.

Primary LanguageGo

File Converter to Base64

Converts any type of file to base64 string.

How to use it?

file2Base64 <file_input> [-o <output_file>] [-v] [-t]

  • file_input: Path of the file to be converted to base64. (required)
  • -o: Path of the output file (optional)
  • -t: Flag to indicate if the result will include the type of the file. I.e.: data:image/png;base64,.... (optional, default: true)
  • -v: Flag to indicate if the result will be also printed on the console when the output file is specified. (optional, default: true)
  • -version: Shows the current version of binary. (optional)

Install

Install on $GOBIN

From Code

make install

From Releases

  • Download the version for your OS
  • Copy the binary to $GOBIN

NOTE: Don't forget add $GOBIN to $PATH.

Build

  • With Makefile: make <OS>, where <OS> can be any of the following options:

    • windows
    • linux
    • darwin

    Makefile also support especify the architecture of the build, only needs set the flag arch with the supported architecture by go:

    make <OS> [arch=<GOARCH>]

    I.e. make linux arch=arm64

  • With Go:

    • go build -ldflags "-X main.version=0.0.1" -o "output_path[.exe]"