operations

Read a single file

Changed on

Returns the contents of one file in the JSON response. It reads at most 2 MiB, so use offset and count, head or tail to read part of a larger file. Only one of those three forms can be used in a call. To stream whole files, use rclone's file serving with --rc-serve instead.

post/operations/getfile

Request

Headers

Prefer'respond-async'

Set to respond-async to run the call in the background. Rclone returns a 202 with a job ID right away, and job/status reports progress. This has the same effect as the _async param in rclone's docs, but _async alone returns a 200 instead of a 202.

Request body

_configobject

Config overrides for this call only.

_filterobject

Filter overrides for this call only.

_groupstring

Stats group for this call.

fsstring required

Remote name or path of the file, for example drive:path/to/file. It can also be a directory, with the file named in remote.

remotestring

Path to the file within fs, for example file.txt.

offsetinteger

Byte offset to start reading at. A negative value counts from the end of the file. Defaults to 0.

countinteger

Number of bytes to read. Defaults to -1, which reads to the end of the file.

headinteger

Read only the first N bytes.

tailinteger

Read only the last N bytes.

maxSizeinteger

Largest number of bytes the call may return. It can only lower the built-in limit of 2097152 bytes (2 MiB).

base64boolean

Set to true to return the contents base64 encoded. Binary files need this, because the call fails when the contents aren't valid UTF-8.

Response

Contents of the file from operations/getfile.

resultstring required

Contents of the file, as text or as a base64 encoded string when base64 is set.

Changes