Start Building
Contents
shdwDrive SDK
shdwDrive CLI
shdwDrive SDK
shdwDrive SDK is a typeScript SDK for interacting with ShdwDrive, providing simple and efficient methods for file operations on the decentralized storage platform.
Installation
# Install from npm
npm install @shdwdrive/sdk
# Or install from repository
git clone https://github.com/GenesysGo/shdwdrive-v2-sdk.git
cd shdwdrive-v2-sdk
npm install
npm run buildLocal Development
cd shdwdrive-v2-sdk
npm link
cd your-project
npm link @shdw-drive/sdkFeatures
- 📤 File uploads (supports both small and large files) 
- 📥 File deletion 
- 📋 File listing 
- 📊 Bucket usage statistics 
- 🗂️ Folder creation and management 
- 🔐 Secure message signing 
- ⚡ Progress tracking for uploads 
- 🔄 Multipart upload support for large files 
Quick Start
import ShdwDriveSDK from '@shdwdrive/sdk';
// Initialize with wallet
const drive = new ShdwDriveSDK({}, { wallet: yourWalletAdapter });
// Or initialize with keypair
const drive = new ShdwDriveSDK({}, { keypair: yourKeypair });Usage Examples
Upload a File
const file = new File(['Hello World'], 'hello.txt', { type: 'text/plain' });
const uploadResponse = await drive.uploadFile('your-bucket', file, {
  onProgress: (progress) => {
    console.log(`Upload progress: ${progress.progress}%`);
  }
});
console.log('File uploaded:', uploadResponse.finalized_location);Create a Folder
const folderResponse = await drive.createFolder('your-bucket', 'folder-name');
console.log('Folder created:', folderResponse.folder_location);Delete a Folder
const deleteFolderResponse = await drive.deleteFolder('your-bucket', 'folder-url');
console.log('Folder deleted:', deleteFolderResponse.success);List Files
const files = await drive.listFiles('your-bucket');
console.log('Files in bucket:', files);Delete a File
const deleteResponse = await drive.deleteFile('your-bucket', 'file-url');
console.log('Delete status:', deleteResponse.success);API Reference
ShdwDriveSDK
ShdwDriveSDKConstructor Options
interface ShdwDriveConfig {
  endpoint?: string; // Optional custom endpoint (defaults to https://v2.shdwdrive.com)
}
// Initialize with either wallet or keypair
new ShdwDriveSDK(config, { wallet: WalletAdapter });
new ShdwDriveSDK(config, { keypair: Keypair });Methods
- uploadFile(bucket: string, file: File, options?: FileUploadOptions)
- deleteFile(bucket: string, fileUrl: string)
- listFiles(bucket: string)
- getBucketUsage(bucket: string)
- createFolder(bucket: string, folderName: string)
- deleteFolder(bucket: string, folderUrl: string)
shdwDrive CLI
A command-line interface for interacting with shdwDrive storage.
Features
- 📤 File uploads (supports both small and large files) 
- 📁 Folder support (create, delete, and manage files in folders) 
- 📥 File and folder deletion 
- 📋 File listing 
- 📊 Bucket usage statistics 
- 🔐 Secure message signing 
- 🔄 Multipart upload support for large files 
Installation
You can install the CLI globally using npm:
npm install -g @shdwdrive/cliOr use it directly from the repository:
git clone https://github.com/genesysgo/shdwdrive-v2-cli.git
cd shdwdrive-v2-cli
npm install
npm run build
npm linkConfiguration
The CLI uses environment variables for configuration:
- SHDW_ENDPOINT: The shdwDrive API endpoint (defaults to https://v2.shdwdrive.com)
Usage
Upload a file
shdw-drive upload \
  --keypair ~/.config/solana/id.json \
  --bucket your-bucket-identifier \
  --file path/to/your/file.txt \
  --folder optional/folder/pathDelete a file
# Delete a file from root of bucket
shdw-drive delete \
  --keypair ~/.config/solana/id.json \
  --bucket your-bucket-identifier \
  --file filename.txt
# Delete a file from a folder
shdw-drive delete \
  --keypair ~/.config/solana/id.json \
  --bucket your-bucket-identifier \
  --file folder/subfolder/filename.jpgCreate a folder
shdw-drive create-folder \
  --keypair ~/.config/solana/id.json \
  --bucket your-bucket-identifier \
  --name my-folder/subfolderList files in a bucket
shdw-drive list \
  --keypair ~/.config/solana/id.json \
  --bucket your-bucket-identifierCheck bucket storage usage
shdw-drive usage \
  --keypair ~/.config/solana/id.json \
  --bucket your-bucket-identifierCommand Options
Upload Options
- -k, --keypair- Path to your Solana keypair file
- -b, --bucket- Your bucket identifier
- -f, --file- Path to the file you want to upload
- -F, --folder- (Optional) Folder path within the bucket
Delete Options
- -k, --keypair- Path to your Solana keypair file
- -b, --bucket- Your bucket identifier
- -f, --file- URL or path of the file to delete
Create Folder Options
- -k, --keypair- Path to your Solana keypair file
- -b, --bucket- Your bucket identifier
- -n, --name- Name/path of the folder to create
Delete Folder Options
- -k, --keypair- Path to your Solana keypair file
- -b, --bucket- Your bucket identifier
- -p, --path- Path of the folder to delete
Development
- Clone the repository: 
git clone https://github.com/genesysgo/shdwdrive-v2-cli.git- Install dependencies: 
cd shdwdrive-v2-cli
npm install- Build the project: 
npm run build- Link the CLI locally: 
npm linkLast updated
