🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@mastra/files-sdk

Package Overview
Dependencies
Maintainers
6
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
This package has malicious versions linked to the ongoing "Mastra AI framework compromise" supply chain attack.

Affected versions:

0.2.1
View campaign page

@mastra/files-sdk

FilesSDK filesystem provider for Mastra workspaces — unified storage across S3, R2, GCS, Azure, Vercel Blob, and more

Source
npmnpm
Version
0.2.2
Version published
Weekly downloads
1.7K
26.02%
Maintainers
6
Weekly downloads
 
Created
Source

@mastra/files-sdk

Unified storage filesystem provider for Mastra workspaces, powered by FilesSDK. Works with any FilesSDK adapter — S3, Cloudflare R2, Google Cloud Storage, Azure Blob, Vercel Blob, local filesystem, and more.

Installation

npm install @mastra/files-sdk files-sdk

Then install the FilesSDK adapter for your storage backend:

# AWS S3 / R2 / MinIO / DigitalOcean Spaces
npm install @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner

# Google Cloud Storage
npm install @google-cloud/storage google-auth-library

# Azure Blob Storage
npm install @azure/storage-blob @azure/core-auth @azure/identity

# Vercel Blob
npm install @vercel/blob

# Local filesystem (dev/test)
# No extra dependencies needed

Usage

import { Agent } from '@mastra/core/agent';
import { Workspace } from '@mastra/core/workspace';
import { FilesSDKFilesystem } from '@mastra/files-sdk';
import { Files } from 'files-sdk';
import { s3 } from 'files-sdk/s3';

const files = new Files({
  adapter: s3({
    bucket: 'my-bucket',
    region: 'us-east-1',
  }),
});

const workspace = new Workspace({
  filesystem: new FilesSDKFilesystem({ files }),
});

const agent = new Agent({
  name: 'my-agent',
  model: 'anthropic/claude-opus-4-5',
  workspace,
});

Switching adapters

The power of FilesSDK is that you can swap storage backends by changing only the adapter import:

import { Files } from 'files-sdk';
import { r2 } from 'files-sdk/r2';

const files = new Files({
  adapter: r2({
    accountId: process.env.R2_ACCOUNT_ID!,
    accessKeyId: process.env.R2_ACCESS_KEY_ID!,
    secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
    bucket: 'my-bucket',
  }),
});

const workspace = new Workspace({
  filesystem: new FilesSDKFilesystem({ files }),
});

Local filesystem for development

import { Files } from 'files-sdk';
import { fs } from 'files-sdk/fs';

const files = new Files({
  adapter: fs({ root: './.uploads' }),
});

const workspace = new Workspace({
  filesystem: new FilesSDKFilesystem({ files }),
});

Options

OptionTypeRequiredDescription
filesFilesYesPre-configured FilesSDK instance
idstringNoUnique filesystem ID (auto-generated)
displayNamestringNoHuman-friendly name for UI
iconstringNoIcon identifier
descriptionstringNoDescription for UI
readOnlybooleanNoMount as read-only

License

Apache-2.0

FAQs

Package last updated on 17 Jun 2026

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