Files.com JavaScript SDK

1.2.610 · active · verified Sun Apr 19

The Files.com JavaScript SDK, currently at version 1.2.610, provides a direct, high-performance integration with the Files.com cloud-native MFT, SFTP, and secure file-sharing platform. It enables applications to programmatically interact with files, folders, users, automations, and other administrative tasks through Files.com's RESTful APIs over HTTPS. This SDK is a core internal component for Files.com, ensuring it is actively maintained, continuously updated, and performant. Releases are frequent, following a MAJOR.MINOR.BUILDNUMBER semantic versioning, where MAJOR or MINOR changes may introduce breaking changes, and BUILDNUMBER updates are generally non-disruptive. Key differentiators include unifying SFTP, AS2, and HTTPS protocols, offering 50+ native connectors, military-grade encryption, and a unified platform for governance, visibility, and compliance, aiming to replace brittle legacy file transfer solutions with a robust, always-on fabric for automating mission-critical file flows.

Common errors

Warnings

Install

Imports

Quickstart

Initializes the Files.com SDK with an API key from environment variables and fetches the current authenticated user's details, demonstrating basic authentication and error handling.

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

const API_KEY = process.env.FILESCOM_API_KEY ?? '';

if (!API_KEY) {
  console.error('FILESCOM_API_KEY environment variable is not set.');
  process.exit(1);
}

Files.setApiKey(API_KEY);

async function fetchCurrentUser() {
  try {
    // Retrieve the current authenticated user's details
    const user = await User.current();
    console.log(`Successfully authenticated as user: ${user.name} (ID: ${user.id})`);
    console.log('User details:', user.attributes);
  } catch (error) {
    if (error instanceof FilesErrors.FilesApiError) {
      console.error(`Files.com API Error: ${error.message} (Status: ${error.httpStatus})`);
    } else {
      console.error('An unexpected error occurred:', error);
    }
    process.exit(1);
  }
}

fetchCurrentUser();

view raw JSON →