ArDrive Core JS
For AI and LLM users: Access the complete ArDrive Core JS documentation in plain text format at llm.txt for easy consumption by AI agents and language models.
The ArDrive Core JS SDK provides a comprehensive TypeScript library for building applications on ArDrive. It offers type-safe interfaces for drive management, file operations, encryption, and seamless integration with Arweave.
Quick Start
Install the SDK
npm install ardrive-core-jsInitialize with a Wallet
import { readJWKFile, arDriveFactory } from 'ardrive-core-js';
// Load your Arweave wallet
const wallet = readJWKFile('./wallet.json');
// Create an ArDrive instance
const arDrive = arDriveFactory({ wallet });Create a Drive and Upload Files
import { wrapFileOrFolder } from 'ardrive-core-js';
// Create a new public drive
const { driveId, rootFolderId } = await arDrive.createPublicDrive({
driveName: 'My-Drive'
});
console.log('Drive created:', driveId.toString());
console.log('Root folder:', rootFolderId.toString());
// Upload a file to the drive
const wrappedFile = wrapFileOrFolder('./my-file.pdf');
const uploadResult = await arDrive.uploadPublicFile({
parentFolderId: rootFolderId,
wrappedFile
});
console.log('File uploaded:', uploadResult.fileId.toString());Install the SDK
npm install ardrive-core-jsConfigure Polyfills
Polyfills are required for web environments due to Node.js dependencies used by the SDK.
npm install --save-dev vite-plugin-node-polyfills// vite.config.js
import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
export default defineConfig({
plugins: [
nodePolyfills({
globals: {
Buffer: true,
global: true,
process: true,
},
}),
],
});Configure your bundler (Webpack, Vite, Rollup, etc.) to provide polyfills for crypto, process, and buffer. Refer to your bundler's documentation for polyfill configuration.
Use the SDK
import { arDriveFactory } from 'ardrive-core-js/web';
// Initialize with a JWK wallet object
const arDrive = arDriveFactory({ wallet: jwkWallet });
// Create a public drive
const { driveId, rootFolderId } = await arDrive.createPublicDrive({
driveName: 'My-Drive'
});
console.log('Drive created:', driveId.toString());Documentation
Source Code
View the complete source code and contribute on GitHub
API Reference
Detailed documentation for all SDK methods and classes
Core Features
Drive Operations
Create and manage public and private drives
Folder Operations
Create folders, list contents, and organize your data
File Operations
Upload, download, and manage files on Arweave
Encryption & Security
End-to-end encryption for private drives and files
Pricing & Cost Estimation
Estimate upload costs before committing transactions
Advanced Features
Turbo integration, bundling, manifests, and more
How is this guide?