
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@julesl23/s5js
Advanced tools
Enhanced TypeScript SDK for S5 decentralized storage with path-based API, media processing, and directory utilities
An enhanced JavaScript/TypeScript SDK for the S5 decentralized storage network, featuring a simple path-based API for file and directory operations.
get(), put(), delete(), list() operationsSee the API Documentation for detailed usage examples.
The enhanced path-based API features are currently in development as part of a Sia Foundation grant project.
Prerequisites:
For production use:
npm install @s5-dev/s5js
To try the enhanced features:
# Clone the repository
git clone https://github.com/julesl23/s5.js
cd s5.js
# Install dependencies (includes TypeScript)
npm install
# Build the project
npm run build
# Run tests with real S5 portal
npm test
Status: These features are pending review and have not been merged into the main S5.js repository.
import { S5 } from "./dist/src/index.js";
// Create S5 instance and connect to real S5 portal
const s5 = await S5.create({
initialPeers: [
"wss://z2DWuPbL5pweybXnEB618pMnV58ECj2VPDNfVGm3tFqBvjF@s5.ninja/s5/p2p",
],
});
// Generate a new seed phrase (save this securely!)
const seedPhrase = s5.generateSeedPhrase();
console.log("Your seed phrase:", seedPhrase);
// Or recover from existing seed phrase
// const seedPhrase = "your saved twelve word seed phrase here";
await s5.recoverIdentityFromSeedPhrase(seedPhrase);
// Register on S5 portal (s5.vup.cx supports the new API)
await s5.registerOnNewPortal("https://s5.vup.cx");
// Initialize filesystem (creates home and archive directories)
await s5.fs.ensureIdentityInitialized();
// Store data
await s5.fs.put("home/documents/hello.txt", "Hello, S5!");
// Retrieve data
const content = await s5.fs.get("home/documents/hello.txt");
console.log(content); // "Hello, S5!"
// List directory contents
for await (const item of s5.fs.list("home/documents")) {
console.log(`${item.type}: ${item.name}`);
}
import { DirectoryWalker, BatchOperations, MediaProcessor } from "./dist/src/index.js";
// Recursive directory traversal
const walker = new DirectoryWalker(s5.fs, '/');
for await (const entry of walker.walk("home", { maxDepth: 3 })) {
console.log(`${entry.path} (${entry.type})`);
}
// Batch operations with progress
const batch = new BatchOperations(s5.fs);
const result = await batch.copyDirectory("home/source", "home/backup", {
onProgress: (progress) => {
console.log(`Copied ${progress.processed} items...`);
}
});
console.log(`Completed: ${result.success} success, ${result.failed} failed`);
// Media processing - extract image metadata
await MediaProcessor.initialize();
const imageBlob = await fetch('/path/to/image.jpg').then(r => r.blob());
const metadata = await MediaProcessor.extractMetadata(imageBlob);
console.log(`Image: ${metadata.width}x${metadata.height} ${metadata.format}`);
console.log(`Dominant colors:`, metadata.dominantColors);
The enhanced S5.js has been successfully integrated with real S5 portal infrastructure. To test:
This test creates a new identity and verifies all functionality:
node test/integration/test-fresh-s5.js
Expected output: 100% success rate (9/9 tests passing)
Comprehensive test of all features:
node test/integration/test-s5-full-integration.js
Tests direct portal communication:
node test/integration/test-portal-direct.js
Tests BatchOperations (copy/delete) with real S5 portal:
node test/integration/test-batch-real.js
This test validates:
Tests FS5 media integration (putImage, getThumbnail, getImageMetadata, createImageGallery) with real S5 instance:
node test/integration/test-media-real.js
This test validates:
Expected output: 10/10 tests passing
https://s5.vup.cx which has the updated API. Other portals may not have the required updates.home/ or archive/The enhanced S5.js includes comprehensive performance benchmarks to verify HAMT efficiency and scaling behaviour.
Test HAMT performance with mock S5 API:
# Basic HAMT verification
node test/mocked/integration/test-hamt-local-simple.js
# Comprehensive scaling test (up to 100K entries)
node test/mocked/integration/test-hamt-mock-comprehensive.js
Test with actual S5 portal (requires internet connection):
# Minimal real portal test
node test/integration/test-hamt-real-minimal.js
# HAMT activation threshold test
node test/integration/test-hamt-activation-real.js
# Full portal performance analysis
node test/integration/test-hamt-real-portal.js
See BENCHMARKS.md for detailed performance analysis showing:
For production deployments, these benchmarks confirm the implementation is ready for large-scale directory operations.
The library supports multiple import strategies to optimize bundle size:
// Full bundle (~60KB compressed with brotli)
import { S5, MediaProcessor } from "s5";
// Core only - no media features (~60KB compressed)
import { S5, FS5 } from "s5/core";
// Media only - for lazy loading (~10KB compressed)
import { MediaProcessor } from "s5/media";
// Advanced CID API - for power users (~60KB compressed)
import { FS5Advanced, formatCID, parseCID } from "s5/advanced";
// Dynamic import for code-splitting
const { MediaProcessor } = await import("s5/media");
Monitor bundle sizes with:
npm run analyze-bundle
For power users who need direct access to Content Identifiers (CIDs), the Advanced API provides content-addressed storage capabilities without affecting the simplicity of the path-based API.
Use the Advanced API if you:
Use the Path-based API if you:
import { S5 } from "s5";
import { FS5Advanced, formatCID, parseCID } from "s5/advanced";
// Setup
const s5 = await S5.create();
await s5.recoverIdentityFromSeedPhrase(seedPhrase);
const advanced = new FS5Advanced(s5.fs);
// Store data and get CID
await s5.fs.put('home/document.txt', 'Important data');
const cid = await advanced.pathToCID('home/document.txt');
console.log(`CID: ${formatCID(cid, 'base32')}`);
// Share the CID string
const cidString = formatCID(cid, 'base58btc');
// Recipient: retrieve by CID alone
const receivedCID = parseCID(cidString);
const data = await advanced.getByCID(receivedCID);
console.log(data); // "Important data"
// Find path from CID
const path = await advanced.cidToPath(receivedCID);
console.log(path); // "home/document.txt"
FS5Advanced Class (4 essential methods):
pathToCID(path) - Extract CID from file/directory pathcidToPath(cid) - Find path for a given CIDgetByCID(cid) - Retrieve data by CID directlyputByCID(data) - Store content-only and return CIDComposition Pattern:
fs.put(path, data) then advanced.pathToCID(path)fs.getMetadata(path) then advanced.pathToCID(path)CID Utilities:
formatCID(cid, encoding?) - Format CID as multibase stringparseCID(cidString) - Parse CID from stringverifyCID(cid, data, crypto) - Verify CID matches datacidToString(cid) - Convert to hex stringSee the Advanced API Documentation for complete details.
Enhanced S5.js includes built-in encryption using XChaCha20-Poly1305, providing both confidentiality and integrity for sensitive data.
// Auto-generate encryption key
await s5.fs.put("home/secrets/credentials.json", sensitiveData, {
encryption: {
algorithm: "xchacha20-poly1305",
},
});
// Retrieve and decrypt automatically
const data = await s5.fs.get("home/secrets/credentials.json");
console.log(data); // Original decrypted data
// Use your own 32-byte encryption key
const myKey = new Uint8Array(32); // Your secure key
crypto.getRandomValues(myKey);
await s5.fs.put("home/private/document.txt", "Secret content", {
encryption: {
algorithm: "xchacha20-poly1305",
key: myKey, // Use specific key
},
});
// Decryption uses key from metadata automatically
const content = await s5.fs.get("home/private/document.txt");
โ ๏ธ Important: Encryption keys are stored in directory metadata. Anyone with directory read access can decrypt files. This design provides:
For complete encryption documentation, examples, and security best practices, see the Encryption section in API.md.
This is an enhanced version of s5.js being developed under an 8-month grant from the Sia Foundation. The project implements a new format using:
Note: This is a clean implementation that does NOT maintain backward compatibility with old S5 data formats.
npm run build # Compile TypeScript
npm run dev # Watch mode
npm run test # Run tests
npm run build # Compile TypeScript to JavaScript
npm run dev # Watch mode for development
npm run type-check # Run TypeScript type checking
npm run test # Run real implementation tests only
npm run test:run # Run tests once
npm run test:mocked # Run mock-based tests
npm run test:all # Run all tests (real + mocked)
npm run test:ui # Run tests with UI
npm run test:coverage # Generate coverage report
# Run specific test suites
npm run test:run test/fs/cid-utils.test.ts test/fs/fs5-advanced.test.ts # Advanced CID API unit tests (74 tests)
test/ - Real implementation tests using actual S5.js functionality
npm test (30+ test files, 284+ tests)test/mocked/ - Mock-based unit and performance tests
npm run test:mocked (15 test files)test/mocked/integration/ - Mock-based integration and performance teststest/integration/ - Real S5 integration tests with actual network connections
For comprehensive testing with real S5 infrastructure, use the standalone integration test scripts:
# Build the project first
npm run build
# Run Advanced CID API integration tests with real S5 portal
node test/integration/test-advanced-cid-real.js
Note: These tests:
The media processing implementation includes comprehensive demos and tests. All Phase 5 deliverables are complete with 100% test coverage.
# Build the project first
npm run build
# Run all Node.js demos
node demos/media/benchmark-media.js # Performance benchmarking
node demos/media/demo-pipeline.js # Pipeline initialization
node demos/media/demo-metadata.js # Metadata extraction
node demos/media/test-media-integration.js # Integration tests (Node.js)
# Run browser tests (all 20 tests pass in browser)
./demos/media/run-browser-tests.sh # Linux/Mac
# Windows: npx http-server -p 8080, then open http://localhost:8080/demos/media/browser-tests.html
# View code-splitting demo (requires HTTP server)
# Linux/Mac: ./demos/media/run-browser-tests.sh (uses port 8081)
# Windows: npx http-server -p 8081, then open http://localhost:8081/demos/media/demo-splitting-simple.html
Node.js Test Expectations:
When running node demos/media/test-media-integration.js:
Browser Test Expectations:
Windows Users:
The bash script ./demos/media/run-browser-tests.sh won't work in Windows CMD. Use one of these alternatives:
# Option 1: Using npx (recommended - no Python needed)
npx http-server -p 8080
# Option 2: Using Python (if installed)
python -m http.server 8080
# Then open in browser:
http://localhost:8080/demos/media/browser-tests.html
Linux/Mac Users:
# Use the provided script
./demos/media/run-browser-tests.sh
# Automatically opens: http://localhost:8081/demos/media/browser-tests.html
Expected Results:
Tests Include:
Evidence Column: Each test shows verification data proving it passes
Run: node demos/media/benchmark-media.js
Output:
baseline-performance.jsonExpected Results:
Run: node demos/media/demo-pipeline.js
Demonstrates:
Key Features:
Run: node demos/media/demo-metadata.js
Processes:
metadata-report.htmlNote: In Node.js, dimensions show 0x0 (expected limitation). Works fully in browser.
Prerequisites: Requires HTTP server
Windows:
npx http-server -p 8081
# Then open: http://localhost:8081/demos/media/demo-splitting-simple.html
Linux/Mac:
./demos/media/run-browser-tests.sh
# Then open: http://localhost:8081/demos/media/demo-splitting-simple.html
Shows:
Browser Environment (Full Support):
Node.js Environment (Limited Canvas):
import { MediaProcessor } from 's5/media';
// Initialize (automatic in browser)
await MediaProcessor.initialize();
// Extract metadata
const blob = new Blob([imageData], { type: 'image/png' });
const metadata = await MediaProcessor.extractMetadata(blob);
console.log(`Image: ${metadata.width}x${metadata.height}`);
console.log(`Format: ${metadata.format}`);
console.log(`Processing: ${metadata.processingTime}ms`);
For integration testing with mock S5 services:
node test/mocked/integration/test-server.js # Start mock server on port 3000
See test-server-README.md for details.
src/api/ - Core S5 API interfaces and crypto implementationssrc/fs/ - File system operations (FS5 implementation)
dirv1/ - CBOR-based directory format implementationhamt/ - Hash Array Mapped Trie for large directoriesutils/ - Directory walker and batch operationssrc/media/ - Media processing and metadata extraction
wasm/ - WebAssembly module wrapper for image processingfallback/ - Canvas-based fallback implementationcompat/ - Browser compatibility detectionsrc/identity/ - User identity and authenticationsrc/node/ - P2P networking and registry operationssrc/kv/ - Key-value storage abstractionssrc/encryption/ - Encryption utilitiessrc/identifier/ - Content identifiers and multibase encodingsrc/util/ - Utility functionssrc/exports/ - Modular export paths for code-splittingSee MILESTONES.md for detailed progress.
Milestone 5 (Advanced Media Processing) has been completed and validated. All grant requirements have been met and exceeded:
Thumbnail Generation โ
Progressive Rendering โ
Browser Compatibility Matrix โ
Bundle Size Optimization โ
s5, s5/core, s5/media, s5/advancedFor complete evidence and testing instructions, see:
MILESTONE5_EVIDENCE.md - Comprehensive evidence document with:
MILESTONE5_TESTING_GUIDE.md - Step-by-step validation guide with:
npm run test:run)node test/integration/test-media-real.js)./test/browser/run-demo.sh)# 1. Run unit tests (437 tests)
npm run test:run
# 2. Run integration test with real S5 network
npm run build
node test/integration/test-media-real.js
# 3. Launch progressive rendering browser demo
./test/browser/run-demo.sh
# 4. Verify bundle size
npm run build
brotli -f -k dist/src/index.js
du -h dist/src/index.js.br # Should show ~60 KB
Status: All Milestone 5 deliverables complete and ready for review.
s5/advanced export)The implementation has been benchmarked to ensure efficient operation:
See BENCHMARKS.md for detailed results.
ensureIdentityInitialized() after portal registrationhome/ or archive/https://s5.vup.cx which has the updated APIhome/ or archive/https://s5.vup.cx for testing (has updated API)This project is being developed under a Sia Foundation grant. For contributions or issues, please refer to the grant proposal.
Licensed under either of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
This is an enhanced version of s5.js being developed under an 8-month grant from the Sia Foundation. The project implements a new format using CBOR serialization with the DirV1 specification.
FAQs
Enhanced TypeScript SDK for S5 decentralized storage with path-based API, media processing, and directory utilities
The npm package @julesl23/s5js receives a total of 0 weekly downloads. As such, @julesl23/s5js popularity was classified as not popular.
We found that @julesl23/s5js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.