Socket
Book a DemoInstallSign in
Socket

files.com

Package Overview
Dependencies
Maintainers
1
Versions
818
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

files.com

Files.com SDK for JavaScript

Source
npmnpm
Version
1.2.329
Version published
Weekly downloads
15K
-15.03%
Maintainers
1
Weekly downloads
 
Created
Source

Files.com JavaScript SDK

The Files.com JavaScript SDK provides a direct, high performance integration to Files.com from applications written in JavaScript.

Files.com is the cloud-native, next-gen MFT, SFTP, and secure file-sharing platform that replaces brittle legacy servers with one always-on, secure fabric. Automate mission-critical file flows—across any cloud, protocol, or partner—while supporting human collaboration and eliminating manual work.

With universal SFTP, AS2, HTTPS, and 50+ native connectors backed by military-grade encryption, Files.com unifies governance, visibility, and compliance in a single pane of glass.

The content included here should be enough to get started, but please visit our Developer Documentation Website for the complete documentation.

Introduction

The Files.com JavaScript SDK provides convenient access to all aspects of Files.com from applications written in JavaScript.

This includes directly working with files and folders as well as performing management tasks such as adding/removing users, onboarding counterparties, retrieving information about automations and more.

The JavaScript SDK uses the Files.com RESTful APIs via the HTTPS protocol (port 443) to securely communicate and transfer files so no firewall changes should be required in order to allow connectivity to Files.com.

JavaScript is a Core Focus at Files.com

This SDK is used internally by several Files.com integrations that we maintain, and we work hard to ensure that it is always up to date and performant.

It is also a very popular choice for Files.com customers looking to integrate with Files.com.

Installation

To install the package, use yarn or npm:

yarn add files.com

or

npm install files.com

Usage

Import and Initialize

import Files from "files.com/lib/Files.js";
require() vs. import

The examples provided in the documentation here use the newer ES6 import syntax. To instead use the older CommonJS module syntax with require(), ensure that .default is included. For example:

const Files = require("files.com/lib/Files.js").default;
const User = require("files.com/lib/models/User.js").default;

// destructure to directly assign a named export
const { LogLevel } = require("files.com/lib/Logger.js").default;

Explore the files-sdk-javascript code on GitHub.

Getting Support

The Files.com Support team provides official support for all of our official Files.com integration tools.

To initiate a support conversation, you can send an Authenticated Support Request or simply send an E-Mail to support@files.com.

Authentication

There are two ways to authenticate: API Key authentication and Session-based authentication.

Authenticate with an API Key

Authenticating with an API key is the recommended authentication method for most scenarios, and is the method used in the examples on this site.

To use an API Key, first generate an API key from the web interface or via the API or an SDK.

Note that when using a user-specific API key, if the user is an administrator, you will have full access to the entire API. If the user is not an administrator, you will only be able to access files that user can access, and no access will be granted to site administration functions in the API.

import Files from 'files.com/lib/Files';
import User from 'files.com/lib/models/User';
import * as FilesErrors from 'files.com/lib/Errors';

Files.setApiKey('YOUR_API_KEY');

try {
  // Alternatively, you can specify the API key on a per-object basis in the second parameter to a model constructor.
  const user = new User(params, { apiKey: 'YOUR_API_KEY' });

  // You may also specify the API key on a per-request basis in the final parameter to static methods.
  await User.find(id, params, { apiKey: 'YOUR_API_KEY' });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Don't forget to replace the placeholder, YOUR_API_KEY, with your actual API key.

Authenticate with a Session

You can also authenticate by creating a user session using the username and password of an active user. If the user is an administrator, the session will have full access to all capabilities of Files.com. Sessions created from regular user accounts will only be able to access files that user can access, and no access will be granted to site administration functions.

Sessions use the exact same session timeout settings as web interface sessions. When a session times out, simply create a new session and resume where you left off. This process is not automatically handled by our SDKs because we do not want to store password information in memory without your explicit consent.

Logging In

To create a session, the create method is called on the Session object with the user's username and password.

This returns a session object that can be used to authenticate SDK method calls.

import Session from 'files.com/lib/models/Session';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  const session = await Session.create({ username: 'motor', password: 'vroom' });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Using a Session

Once a session has been created, you can store the session globally, use the session per object, or use the session per request to authenticate SDK operations.

import Files from 'files.com/lib/Files';
import User from 'files.com/lib/models/User';
import * as FilesErrors from 'files.com/lib/Errors';

// You may set the returned session ID to be used by default for subsequent requests.
Files.setSessionId(session.id);

try {
  // Alternatively, you can specify the session ID on a per-object basis in the second parameter to a model constructor.
  const user = new User(params, { session_id: session.id });

  // You may also specify the session ID on a per-request basis in the final parameter to static methods.
  await User.find(id, params, { session_id: session.id });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Logging Out

User sessions can be ended calling the destroy method on the session object.

import Session from 'files.com/lib/models/Session';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  await Session.destroy();
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Configuration

Global configuration is performed by calling methods on the Files object.

Configuration Options

Base URL

Setting the base URL for the API is required if your site is configured to disable global acceleration. This can also be set to use a mock server in development or CI.

import Files from 'files.com/lib/Files';

Files.setBaseUrl("https://MY-SUBDOMAIN.files.com");

Log Level

Supported values:

  • LogLevel.NONE
  • LogLevel.ERROR
  • LogLevel.WARN
  • LogLevel.INFO (default)
  • LogLevel.DEBUG
import Files from 'files.com/lib/Files';
import { LogLevel } from 'files.com/lib/Logger';

Files.setLogLevel(LogLevel.INFO);

Debugging

Enable debug logging of API requests and/or response headers. Both settings default to false.

import Files from 'files.com/lib/Files';

Files.configureDebugging({
  debugRequest: true,
  debugResponseHeaders: true,
});

Network Settings

import Files from 'files.com/lib/Files';

Files.configureNetwork({
  // max retries (default: 3)
  maxNetworkRetries: 3,

  // minimum delay in seconds before retrying (default: 0.5)
  minNetworkRetryDelay: 0.5,

  // max delay in seconds before retrying (default: 1.5)
  maxNetworkRetryDelay: 1.5,

  // network timeout in seconds (default: 30.0)
  networkTimeout: 30.0,

  // auto-fetch all pages when results span multiple pages (default: `true`)
  autoPaginate: true,
});

Sort and Filter

Several of the Files.com API resources have list operations that return multiple instances of the resource. The List operations can be sorted and filtered.

Sorting

To sort the returned data, pass in the sort_by method argument.

Each resource supports a unique set of valid sort fields and can only be sorted by one field at a time.

The argument value is a Javascript object that has a property of the resource field name sort on and a value of either "asc" or "desc" to specify the sort order.

Special note about the List Folder Endpoint

For historical reasons, and to maintain compatibility with a variety of other cloud-based MFT and EFSS services, Folders will always be listed before Files when listing a Folder. This applies regardless of the sorting parameters you provide. These will be used, after the initial sort application of Folders before Files.

import User from 'files.com/lib/models/User';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  // Users, sorted by username in ascending order.
  const users = await User.list({
    sort_by: { username: "asc" }
  });

  users.forEach(user => {
    console.log(user.username);
  });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Filtering

Filters apply selection criteria to the underlying query that returns the results. They can be applied individually or combined with other filters, and the resulting data can be sorted by a single field.

Each resource supports a unique set of valid filter fields, filter combinations, and combinations of filters and sort fields.

The passed in argument value is a Javascript object that has a property of the resource field name to filter on and a passed in value to use in the filter comparison.

Filter Types

FilterTypeDescription
filterExactFind resources that have an exact field value match to a passed in value. (i.e., FIELD_VALUE = PASS_IN_VALUE).
filter_prefixPatternFind resources where the specified field is prefixed by the supplied value. This is applicable to values that are strings.
filter_gtRangeFind resources that have a field value that is greater than the passed in value. (i.e., FIELD_VALUE > PASS_IN_VALUE).
filter_gteqRangeFind resources that have a field value that is greater than or equal to the passed in value. (i.e., FIELD_VALUE >= PASS_IN_VALUE).
filter_ltRangeFind resources that have a field value that is less than the passed in value. (i.e., FIELD_VALUE < PASS_IN_VALUE).
filter_lteqRangeFind resources that have a field value that is less than or equal to the passed in value. (i.e., FIELD_VALUE <= PASS_IN_VALUE).
import User from 'files.com/lib/models/User';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  // Users who are not site admins.
  const users = await User.list({
    filter: { not_site_admin: true }
  });

  users.forEach(user => {
    console.log(user.username);
  });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}
import User from 'files.com/lib/models/User';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  // Users who haven't logged in since 2024-01-01.
  const users = await User.list({
    filter_gteq: { last_login_at: "2024-01-01" }
  });

  users.forEach(user => {
    console.log(user.username);
  });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}
import User from 'files.com/lib/models/User';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  // Users whose usernames start with 'test'.
  const users = await User.list({
    filter_prefix: { username: "test" }
  });

  users.forEach(user => {
    console.log(user.username);
  });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}
import User from 'files.com/lib/models/User';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  // Users whose usernames start with 'test' and are not site admins, sorted by last login date.
  const users = await User.list({
    filter_prefix: { username: "test" },
    filter: { not_site_admin: true },
    sort_by: { last_login_at: "asc" }
  });

  users.forEach(user => {
    console.log(user.username);
  });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Paths

Working with paths in Files.com involves several important considerations. Understanding how path comparisons are applied helps developers ensure consistency and accuracy across all interactions with the platform.

Capitalization

Files.com compares paths in a case-insensitive manner. This means path segments are treated as equivalent regardless of letter casing.

For example, all of the following resolve to the same internal path:

Path VariantInterpreted As
Documents/Reports/Q1.pdfdocuments/reports/q1.pdf
documents/reports/q1.PDFdocuments/reports/q1.pdf
DOCUMENTS/REPORTS/Q1.PDFdocuments/reports/q1.pdf

This behavior applies across:

  • API requests
  • Folder and file lookup operations
  • Automations and workflows

See also: Case Sensitivity Documentation

The pathNormalizer.same function in the Files.com SDK is designed to help you determine if two paths on your native file system would be considered the same on Files.com. This is particularly important when handling errors related to duplicate file names and when developing tools for folder synchronization.

import { pathNormalizer } from 'files.com/lib/utils';

if (pathNormalizer.same('Fïłèńämê.Txt', 'filename.txt')) {
  // the paths are the same
}

Slashes

All path parameters in Files.com (API, SDKs, CLI, automations, integrations) must omit leading and trailing slashes. Paths are always treated as absolute and slash-delimited, so only internal / separators are used and never at the start or end of the string.

Path Slash Examples

PathValid?Notes
folder/subfolder/file.txtCorrect, internal separators only
/folder/subfolder/file.txtLeading slash not allowed
folder/subfolder/file.txt/Trailing slash not allowed
//folder//file.txtDuplicate separators not allowed

Unicode Normalization

Files.com normalizes all paths using Unicode NFC (Normalization Form C) before comparison. This ensures consistency across different representations of the same characters.

For example, the following two paths are treated as equivalent after NFC normalization:

InputNormalized Form
uploads/\u0065\u0301.txtuploads/é.txt
docs/Café/Report.txtdocs/Café/Report.txt
  • All input must be UTF‑8 encoded.
  • Precomposed and decomposed characters are unified.
  • This affects search, deduplication, and comparisons across SDKs.

Foreign Language Support

The Files.com Javascript SDK supports localized responses by using the Files.setLanguage() configuration method. When configured, this guides the API in selecting a preferred language for applicable response content.

Language support currently applies to select human-facing fields only, such as notification messages and error descriptions.

If the specified language is not supported or the value is omitted, the API defaults to English.

import Files from 'files.com/lib/Files';

Files.setLanguage('es');

Errors

The Files.com JavaScript SDK will return errors by raising exceptions. There are many exception classes defined in the Files SDK that correspond to specific errors.

The raised exceptions come from two categories:

  • SDK Exceptions - errors that originate within the SDK
  • API Exceptions - errors that occur due to the response from the Files.com API. These errors are grouped into common error types.

There are several types of exceptions within each category. Exception classes indicate different types of errors and are named in a fashion that describe the general premise of the originating error. More details can be found in the exception object message using the message attribute.

Use standard Javascript exception handling to detect and deal with errors. It is generally recommended to catch specific errors first, then catch the general FilesError exception as a catch-all.

import Session from 'files.com/lib/models/Session';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  const session = await Session.create({ username: 'USERNAME', password: 'BADPASSWORD' });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Error Types

SDK Errors

SDK errors are general errors that occur within the SDK code. These errors generate exceptions. Each of these exception classes inherit from a standard FilesError base class.

import * as FilesErrors from 'files.com/lib/Errors'

FilesErrors.ConfigurationError ->
FilesErrors.FilesError ->
Error
SDK Exception Classes
Exception Class NameDescription
ConfigurationErrorInvalid SDK configuration parameters
EmptyPropertyErrorMissing a required property
InvalidParameterErrorA passed in parameter is invalid
MissingParameterErrorA method parameter is missing
NotImplementedErrorThe called method has not be implemented by the SDK

API Errors

API errors are errors returned by the Files.com API. Each exception class inherits from an error group base class. The error group base class indicates a particular type of error.

import * as FilesErrors from 'files.com/lib/Errors'

FilesErrors.NotAuthorized_FolderAdminPermissionRequiredError ->
FilesErrors.NotAuthorizedError ->
FilesErrors.FilesApiError  ->
FilesErrors.FilesError  ->
Error
API Exception Classes
Exception Class NameError Group
BadRequest_AgentUpgradeRequiredErrorBadRequestError
BadRequest_AttachmentTooLargeErrorBadRequestError
BadRequest_CannotDownloadDirectoryErrorBadRequestError
BadRequest_CantMoveWithMultipleLocationsErrorBadRequestError
BadRequest_DatetimeParseErrorBadRequestError
BadRequest_DestinationSameErrorBadRequestError
BadRequest_DoesNotSupportSortingErrorBadRequestError
BadRequest_FolderMustNotBeAFileErrorBadRequestError
BadRequest_FoldersNotAllowedErrorBadRequestError
BadRequest_InvalidBodyErrorBadRequestError
BadRequest_InvalidCursorErrorBadRequestError
BadRequest_InvalidCursorTypeForSortErrorBadRequestError
BadRequest_InvalidEtagsErrorBadRequestError
BadRequest_InvalidFilterAliasCombinationErrorBadRequestError
BadRequest_InvalidFilterFieldErrorBadRequestError
BadRequest_InvalidFilterParamErrorBadRequestError
BadRequest_InvalidFilterParamFormatErrorBadRequestError
BadRequest_InvalidFilterParamValueErrorBadRequestError
BadRequest_InvalidInputEncodingErrorBadRequestError
BadRequest_InvalidInterfaceErrorBadRequestError
BadRequest_InvalidOauthProviderErrorBadRequestError
BadRequest_InvalidPathErrorBadRequestError
BadRequest_InvalidReturnToUrlErrorBadRequestError
BadRequest_InvalidSortFieldErrorBadRequestError
BadRequest_InvalidSortFilterCombinationErrorBadRequestError
BadRequest_InvalidUploadOffsetErrorBadRequestError
BadRequest_InvalidUploadPartGapErrorBadRequestError
BadRequest_InvalidUploadPartSizeErrorBadRequestError
BadRequest_MethodNotAllowedErrorBadRequestError
BadRequest_MultipleSortParamsNotAllowedErrorBadRequestError
BadRequest_NoValidInputParamsErrorBadRequestError
BadRequest_PartNumberTooLargeErrorBadRequestError
BadRequest_PathCannotHaveTrailingWhitespaceErrorBadRequestError
BadRequest_ReauthenticationNeededFieldsErrorBadRequestError
BadRequest_RequestParamsContainInvalidCharacterErrorBadRequestError
BadRequest_RequestParamsInvalidErrorBadRequestError
BadRequest_RequestParamsRequiredErrorBadRequestError
BadRequest_SearchAllOnChildPathErrorBadRequestError
BadRequest_UnrecognizedSortIndexErrorBadRequestError
BadRequest_UnsupportedCurrencyErrorBadRequestError
BadRequest_UnsupportedHttpResponseFormatErrorBadRequestError
BadRequest_UnsupportedMediaTypeErrorBadRequestError
BadRequest_UserIdInvalidErrorBadRequestError
BadRequest_UserIdOnUserEndpointErrorBadRequestError
BadRequest_UserRequiredErrorBadRequestError
NotAuthenticated_AdditionalAuthenticationRequiredErrorNotAuthenticatedError
NotAuthenticated_ApiKeySessionsNotSupportedErrorNotAuthenticatedError
NotAuthenticated_AuthenticationRequiredErrorNotAuthenticatedError
NotAuthenticated_BundleRegistrationCodeFailedErrorNotAuthenticatedError
NotAuthenticated_FilesAgentTokenFailedErrorNotAuthenticatedError
NotAuthenticated_InboxRegistrationCodeFailedErrorNotAuthenticatedError
NotAuthenticated_InvalidCredentialsErrorNotAuthenticatedError
NotAuthenticated_InvalidOauthErrorNotAuthenticatedError
NotAuthenticated_InvalidOrExpiredCodeErrorNotAuthenticatedError
NotAuthenticated_InvalidSessionErrorNotAuthenticatedError
NotAuthenticated_InvalidUsernameOrPasswordErrorNotAuthenticatedError
NotAuthenticated_LockedOutErrorNotAuthenticatedError
NotAuthenticated_LockoutRegionMismatchErrorNotAuthenticatedError
NotAuthenticated_OneTimePasswordIncorrectErrorNotAuthenticatedError
NotAuthenticated_TwoFactorAuthenticationErrorErrorNotAuthenticatedError
NotAuthenticated_TwoFactorAuthenticationSetupExpiredErrorNotAuthenticatedError
NotAuthorized_ApiKeyIsDisabledErrorNotAuthorizedError
NotAuthorized_ApiKeyIsPathRestrictedErrorNotAuthorizedError
NotAuthorized_ApiKeyOnlyForDesktopAppErrorNotAuthorizedError
NotAuthorized_ApiKeyOnlyForMobileAppErrorNotAuthorizedError
NotAuthorized_ApiKeyOnlyForOfficeIntegrationErrorNotAuthorizedError
NotAuthorized_BillingOrSiteAdminPermissionRequiredErrorNotAuthorizedError
NotAuthorized_BillingPermissionRequiredErrorNotAuthorizedError
NotAuthorized_BundleMaximumUsesReachedErrorNotAuthorizedError
NotAuthorized_BundlePermissionRequiredErrorNotAuthorizedError
NotAuthorized_CannotLoginWhileUsingKeyErrorNotAuthorizedError
NotAuthorized_CantActForOtherUserErrorNotAuthorizedError
NotAuthorized_ContactAdminForPasswordChangeHelpErrorNotAuthorizedError
NotAuthorized_FilesAgentFailedAuthorizationErrorNotAuthorizedError
NotAuthorized_FolderAdminOrBillingPermissionRequiredErrorNotAuthorizedError
NotAuthorized_FolderAdminPermissionRequiredErrorNotAuthorizedError
NotAuthorized_FullPermissionRequiredErrorNotAuthorizedError
NotAuthorized_HistoryPermissionRequiredErrorNotAuthorizedError
NotAuthorized_InsufficientPermissionForParamsErrorNotAuthorizedError
NotAuthorized_InsufficientPermissionForSiteErrorNotAuthorizedError
NotAuthorized_MoverAccessDeniedErrorNotAuthorizedError
NotAuthorized_MoverPackageRequiredErrorNotAuthorizedError
NotAuthorized_MustAuthenticateWithApiKeyErrorNotAuthorizedError
NotAuthorized_NeedAdminPermissionForInboxErrorNotAuthorizedError
NotAuthorized_NonAdminsMustQueryByFolderOrPathErrorNotAuthorizedError
NotAuthorized_NotAllowedToCreateBundleErrorNotAuthorizedError
NotAuthorized_NotEnqueuableSyncErrorNotAuthorizedError
NotAuthorized_PasswordChangeNotRequiredErrorNotAuthorizedError
NotAuthorized_PasswordChangeRequiredErrorNotAuthorizedError
NotAuthorized_PaymentMethodErrorErrorNotAuthorizedError
NotAuthorized_ReadOnlySessionErrorNotAuthorizedError
NotAuthorized_ReadPermissionRequiredErrorNotAuthorizedError
NotAuthorized_ReauthenticationFailedErrorNotAuthorizedError
NotAuthorized_ReauthenticationFailedFinalErrorNotAuthorizedError
NotAuthorized_ReauthenticationNeededActionErrorNotAuthorizedError
NotAuthorized_RecaptchaFailedErrorNotAuthorizedError
NotAuthorized_SelfManagedRequiredErrorNotAuthorizedError
NotAuthorized_SiteAdminRequiredErrorNotAuthorizedError
NotAuthorized_SiteFilesAreImmutableErrorNotAuthorizedError
NotAuthorized_TwoFactorAuthenticationRequiredErrorNotAuthorizedError
NotAuthorized_UserIdWithoutSiteAdminErrorNotAuthorizedError
NotAuthorized_WriteAndBundlePermissionRequiredErrorNotAuthorizedError
NotAuthorized_WritePermissionRequiredErrorNotAuthorizedError
NotFound_ApiKeyNotFoundErrorNotFoundError
NotFound_BundlePathNotFoundErrorNotFoundError
NotFound_BundleRegistrationNotFoundErrorNotFoundError
NotFound_CodeNotFoundErrorNotFoundError
NotFound_FileNotFoundErrorNotFoundError
NotFound_FileUploadNotFoundErrorNotFoundError
NotFound_GroupNotFoundErrorNotFoundError
NotFound_InboxNotFoundErrorNotFoundError
NotFound_NestedNotFoundErrorNotFoundError
NotFound_PlanNotFoundErrorNotFoundError
NotFound_SiteNotFoundErrorNotFoundError
NotFound_UserNotFoundErrorNotFoundError
ProcessingFailure_AgentUnavailableErrorProcessingFailureError
ProcessingFailure_AlreadyCompletedErrorProcessingFailureError
ProcessingFailure_AutomationCannotBeRunManuallyErrorProcessingFailureError
ProcessingFailure_BehaviorNotAllowedOnRemoteServerErrorProcessingFailureError
ProcessingFailure_BundleOnlyAllowsPreviewsErrorProcessingFailureError
ProcessingFailure_BundleOperationRequiresSubfolderErrorProcessingFailureError
ProcessingFailure_CouldNotCreateParentErrorProcessingFailureError
ProcessingFailure_DestinationExistsErrorProcessingFailureError
ProcessingFailure_DestinationFolderLimitedErrorProcessingFailureError
ProcessingFailure_DestinationParentConflictErrorProcessingFailureError
ProcessingFailure_DestinationParentDoesNotExistErrorProcessingFailureError
ProcessingFailure_ExceededRuntimeLimitErrorProcessingFailureError
ProcessingFailure_ExpiredPrivateKeyErrorProcessingFailureError
ProcessingFailure_ExpiredPublicKeyErrorProcessingFailureError
ProcessingFailure_ExportFailureErrorProcessingFailureError
ProcessingFailure_ExportNotReadyErrorProcessingFailureError
ProcessingFailure_FailedToChangePasswordErrorProcessingFailureError
ProcessingFailure_FileLockedErrorProcessingFailureError
ProcessingFailure_FileNotUploadedErrorProcessingFailureError
ProcessingFailure_FilePendingProcessingErrorProcessingFailureError
ProcessingFailure_FileProcessingErrorErrorProcessingFailureError
ProcessingFailure_FileTooBigToDecryptErrorProcessingFailureError
ProcessingFailure_FileTooBigToEncryptErrorProcessingFailureError
ProcessingFailure_FileUploadedToWrongRegionErrorProcessingFailureError
ProcessingFailure_FilenameTooLongErrorProcessingFailureError
ProcessingFailure_FolderLockedErrorProcessingFailureError
ProcessingFailure_FolderNotEmptyErrorProcessingFailureError
ProcessingFailure_HistoryUnavailableErrorProcessingFailureError
ProcessingFailure_InvalidBundleCodeErrorProcessingFailureError
ProcessingFailure_InvalidFileTypeErrorProcessingFailureError
ProcessingFailure_InvalidFilenameErrorProcessingFailureError
ProcessingFailure_InvalidPriorityColorErrorProcessingFailureError
ProcessingFailure_InvalidRangeErrorProcessingFailureError
ProcessingFailure_InvalidSiteErrorProcessingFailureError
ProcessingFailure_MetadataNotSupportedOnRemotesErrorProcessingFailureError
ProcessingFailure_ModelSaveErrorErrorProcessingFailureError
ProcessingFailure_MultipleProcessingErrorsErrorProcessingFailureError
ProcessingFailure_PathTooLongErrorProcessingFailureError
ProcessingFailure_RecipientAlreadySharedErrorProcessingFailureError
ProcessingFailure_RemoteServerErrorErrorProcessingFailureError
ProcessingFailure_ResourceBelongsToParentSiteErrorProcessingFailureError
ProcessingFailure_ResourceLockedErrorProcessingFailureError
ProcessingFailure_SubfolderLockedErrorProcessingFailureError
ProcessingFailure_SyncInProgressErrorProcessingFailureError
ProcessingFailure_TwoFactorAuthenticationCodeAlreadySentErrorProcessingFailureError
ProcessingFailure_TwoFactorAuthenticationCountryBlacklistedErrorProcessingFailureError
ProcessingFailure_TwoFactorAuthenticationGeneralErrorErrorProcessingFailureError
ProcessingFailure_TwoFactorAuthenticationMethodUnsupportedErrorErrorProcessingFailureError
ProcessingFailure_TwoFactorAuthenticationUnsubscribedRecipientErrorProcessingFailureError
ProcessingFailure_UpdatesNotAllowedForRemotesErrorProcessingFailureError
RateLimited_DuplicateShareRecipientErrorRateLimitedError
RateLimited_ReauthenticationRateLimitedErrorRateLimitedError
RateLimited_TooManyConcurrentLoginsErrorRateLimitedError
RateLimited_TooManyConcurrentRequestsErrorRateLimitedError
RateLimited_TooManyLoginAttemptsErrorRateLimitedError
RateLimited_TooManyRequestsErrorRateLimitedError
RateLimited_TooManySharesErrorRateLimitedError
ServiceUnavailable_AutomationsUnavailableErrorServiceUnavailableError
ServiceUnavailable_MigrationInProgressErrorServiceUnavailableError
ServiceUnavailable_SiteDisabledErrorServiceUnavailableError
ServiceUnavailable_UploadsUnavailableErrorServiceUnavailableError
SiteConfiguration_AccountAlreadyExistsErrorSiteConfigurationError
SiteConfiguration_AccountOverdueErrorSiteConfigurationError
SiteConfiguration_NoAccountForSiteErrorSiteConfigurationError
SiteConfiguration_SiteWasRemovedErrorSiteConfigurationError
SiteConfiguration_TrialExpiredErrorSiteConfigurationError
SiteConfiguration_TrialLockedErrorSiteConfigurationError
SiteConfiguration_UserRequestsEnabledRequiredErrorSiteConfigurationError

Pagination

Certain API operations return lists of objects. When the number of objects in the list is large, the API will paginate the results.

The Files.com JavaScript SDK automatically paginates through lists of objects by default.

import File from 'files.com/lib/models/File';
import * as FilesErrors from 'files.com/lib/Errors';

Files.configureNetwork({
  // true by default
  autoPaginate: true,
});

try {
  const files = await Folder.listFor(path, {
    search: "some-partial-filename",
  });
  for (const file of files) {
    // Operate on file
  }
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

Mock Server

Files.com publishes a Files.com API server, which is useful for testing your use of the Files.com SDKs and other direct integrations against the Files.com API in an integration test environment.

It is a Ruby app that operates as a minimal server for the purpose of testing basic network operations and JSON encoding for your SDK or API client. It does not maintain state and it does not deeply inspect your submissions for correctness.

Eventually we will add more features intended for integration testing, such as the ability to intentionally provoke errors.

Download the server as a Docker image via Docker Hub.

The Source Code is also available on GitHub.

A README is available on the GitHub link.

Keywords

files.com

FAQs

Package last updated on 04 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts