prefix="/usr/local"
version="16.13.1"
package="node-v${version}-linux-x64"
url="https://nodejs.org/dist/v${version}/${package}.tar.xz"
file="$(basename "$url")"

(
    dir_tmp="$(mktemp -d)"
    trap 'rm -rf "$dir_tmp"' EXIT
    cd "$dir_tmp"
    wget "$url"
    # sudo tar -xf "$file" -C "$prefix" --strip-components=1
    sudo tar -xf "$file" -C "/opt"
    printf '%s\n'
        "export PATH=\"/opt/${package}/bin:\$PATH\""
        > "$HOME/.profile/node.sh"
)