Configuration
Global configuration is performed by calling methods on the Files object.
Configuration Options
Base URL
Set this to the full https:// URL of your Files.com subdomain (e.g. https://MY-SUBDOMAIN.files.com).
This is not required in most cases, but one benefit of setting it is that it ensures that authentication failures will be logged to your site's API logs. Without setting this, we won't know which site to associate the authentication failure with, and it won't be logged to your site's API logs.
This is always required if your site is configured to disable global acceleration.
This can also be set to use a mock server in development or CI.
Log Level
Supported values:
- LogLevel.NONE
- LogLevel.ERROR
- LogLevel.WARN
- LogLevel.INFO (default)
- LogLevel.DEBUG
Debugging
Enable debug logging of API requests and/or response headers. Both settings default to false.
Network Settings
networkTimeout (in seconds, 110 by default) limits each attempt of a request as one budget, from sending it until its
response body has been read to its end; 0 or less sets no limit. An attempt that runs out of time before its response
arrives is retried like a network failure, up to maxNetworkRetries, and one whose body stops arriving fails with a
"Request timed out" FilesError. Each retry has a budget of its own, and the wait between attempts counts toward none.
Nothing limits a call as a whole: give it a signal in its options, such as AbortSignal.timeout(milliseconds), for
that.
Aborting a call's signal stops its requests at once, a wait before a retry included, and starts no further attempt.
The call rejects with the signal's reason, unchanged, or, when the runtime gives none, an Error named AbortError.
A body that a call returns unread, as a stream, stays within its attempt until it has been read to its end: if the budget runs out, or the signal is aborted, before then, the call has already resolved, so the stream is stopped and fails with an error instead.