You can use catchfile.
%%% filecontents is used just to make the example self-contained
\begin{filecontents*}{\jobname.txt}
20
\end{filecontents*}
\documentclass{article}
\usepackage{catchfile}
\usepackage{calc}
%%%
% define \x to be the contents of the file
\CatchFileDef{\x}{\jobname.txt}{}
% now use it
\setlength\parskip{1pt * \x}
%%%
\begin{document}
Hello, world! \the\parskip
\end{document}

You can then use \x wherever and whenever you need it. I'd use a more descriptive name, though.
For a single use, I'd not leave around a definition of \x; in this case you can replace the code in the %%% pair with
%%%
\begingroup\CatchFileDef{\x}{\jobname.txt}{}
\edef\x{\endgroup\noexpand\setlength\parskip{1pt * \x}}\x
%%%
Here's a more general version that allows you to perform various actions with the content of a file. In the second argument to \usefile you use #1 to refer to the file contents.
\begin{filecontents*}{\jobname.txt}
20
\end{filecontents*}
\documentclass{article}
\usepackage{calc}
\ExplSyntaxOn
\NewDocumentCommand{\usefile}{mm}
{% #1 = file name, #2 = action to perform
\yegor_usefile:nn { #1 } { #2 }
}
\tl_new:N \l__yegor_usefile_tl
\cs_new_protected:Nn \yegor_usefile:nn
{
\cs_set_protected:Nn __yegor_usefile_aux:n { #2 }
\file_get:nnN { #1 } { } \l__yegor_usefile_tl
__yegor_usefile_aux:V \l__yegor_usefile_tl
}
\cs_new_protected:Nn __yegor_usefile_aux:n {}
\cs_generate_variant:Nn __yegor_usefile_aux:n { V }
\ExplSyntaxOff
\usefile{\jobname.txt}{\setlength{\parskip}{1pt * #1}}
\begin{document}
Hello, world! \the\parskip
\end{document}
\setlength\parskip{6pt}and then\input{size}. – Teepeemm Jan 02 '22 at 17:53size.txtfile, as a positive integer – yegor256 Jan 02 '22 at 17:54