Getting started

Connect your React Native app to SMB shares — NAS boxes, Windows file servers, and network drives — with native performance via libsmb2 and Nitro Modules.

Introduction

@cetapod/react-native-smb exposes a full SMBv2/v3 client to React Native. Every operation returns an SmbTask<T> — start work immediately, await the result, subscribe to progress, or cancel at any time.

Key capabilities:

  • Connect, list shares, browse directories, upload/download files
  • Create, delete, move, rename, copy, duplicate items
  • Read Windows ACL / security descriptors
  • 4-slot connection pool with interactive-priority scheduling
  • React hooks for task subscriptions and transfer trays
Task-first API. Creating a task starts native work immediately. Nothing is subscribed until you call .subscribe() or .result(). See the Task model guide for patterns.

Install

terminal
npm install @cetapod/react-native-smb react-native-nitro-modules
cd ios && pod install

react-native-nitro-modules is a required peer dependency. The library ships prebuilt iOS binaries via CocoaPods.

Test on Wi‑Fi. Port 445 is often blocked on cellular networks. Use a local network or VPN when developing.

Quick start

App.tsx
import { SMB, SmbCredentials } from '@cetapod/react-native-smb';

const smb = SMB();
const creds: SmbCredentials = {
  username: 'user',
  password: 'pass',
};

// Connect and mount share from URL
const info = await smb
  .connect('smb://192.168.1.100/Media', creds)
  .result();
console.log(info.share); // "Media"

// List root directory
const entries = await smb
  .listDirectory('/', false)
  .result();

// Download with progress
const task = smb.downloadFile(
  '/video.mp4',
  '/local/video.mp4',
);
task.subscribe((snap) => console.log(snap.progress));
await task.result();

Run the example app to explore the full feature set:

terminal
npm run example

URL format

SMB URL
smb://[<domain;>][<username>@]<host>[:<port>]/<share>/<path>
ExampleDescription
smb://nas.local/PhotosConnect to share Photos on nas.local
smb://user@192.168.1.100/DocumentsUsername in URL (password via creds)
smb://WORKGROUP;admin@server/ShareDomain + username
smb://192.168.1.100:445/Media/video.mp4Custom port and path

Compatibility

DependencyVersionStatus
React Native>= 0.76Supported
React>= 19Supported
react-native-nitro-modules>= 0.22, < 1.0Required
iOS12+Supported
AndroidComing soon
SMB protocolv2 / v3Supported