source/factory.js
function getFileContents(remoteFilename, options) {
            const getOptions = merge(baseOptions, options || {});
            getOptions.format = getOptions.format || "binary";
            if (["binary", "text"].indexOf(getOptions.format) < 0) {
                throw new Error("Unknown format: " + getOptions.format);
            }
            return getOptions.format === "text"
                ? getFile.getFileContentsString(remoteFilename, getOptions)
                : getFile.getFileContentsBuffer(remoteFilename, getOptions);
        }
function getFileContents(remoteFilename, options) {
            const getOptions = merge(baseOptions, options || {});
            getOptions.format = getOptions.format || "binary";
            if (["binary", "text"].indexOf(getOptions.format) < 0) {
                throw new Error("Unknown format: " + getOptions.format);
            }
            return getOptions.format === "text"
                ? getFile.getFileContentsString(remoteFilename, getOptions)
                : getFile.getFileContentsBuffer(remoteFilename, getOptions);
        }
function getFileContents ( remoteFilename , options ) { const getOptions = merge ( baseOptions , options || { } ) ; getOptions . format = getOptions . format || "binary" ; if ( [ "binary" , "text" ] . indexOf ( getOptions . format ) < 0 ) { throw new Error ( "Unknown format: " + getOptions . format ) ; } return getOptions . format === "text" ? getFile . getFileContentsString ( remoteFilename , getOptions ) : getFile . getFileContentsBuffer ( remoteFilename , getOptions ) ; }
Get the contents of a remote file
@param {String} remoteFilename The file to fetch
@param {OptionsWithFormat=} options Options for the request
@memberof ClientInterface
@returns {Promise.<Buffer|String>} A promise that resolves with the contents of the remote file
@example
// Fetching data:
const buff = await client.getFileContents("/image.png");
// Fetching text:
const txt = await client.getFileContents("/list.txt", { format: "text" });
Get the contents of a remote file