npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@utho-community/object-storage

v1.0.1

Published

Utho Community plugin for Node.js integration with Utho.com Object Storage services. Provides TypeScript API client, bucket and object operations, and dual authentication support.

Readme

Utho Object Storage SDK

A simple and powerful Node.js SDK for Utho.com Object Storage services. Upload, download, and manage your files in the cloud with just a few lines of code.

npm version

Features

  • Simple Setup: Just provide your token and start uploading
  • File Upload: Upload single or multiple files with folder support
  • TypeScript Support: Full type definitions included
  • Bucket Management: Create, list, and manage buckets
  • Folder Support: Organize files in folders (fixed!)
  • Dual Authentication: Bearer token or Access/Secret keys

Installation

npm install @utho-community/object-storage

Quick Start

import { UthoObjectStorage } from '@utho-community/object-storage';

// Create client with Bearer token
const client = new UthoObjectStorage({
  token: 'your-bearer-token' // Get from Utho dashboard
});

// Upload a file
const fileContent = Buffer.from('Hello, World!', 'utf-8');
await client.uploadFile('innoida', 'my-bucket', fileContent, 'hello.txt');

// Upload file to a folder
await client.uploadFile('innoida', 'my-bucket', fileContent, 'documents/hello.txt');

Examples

Single File Upload

import { UthoObjectStorage } from '@utho-community/object-storage';

const client = new UthoObjectStorage({
  token: 'your-bearer-token'
});

const dcslug = 'innoida';
const bucketName = 'my-bucket';

// Example 1: Upload to bucket root
const content1 = Buffer.from('Hello World', 'utf-8');
await client.uploadFile(dcslug, bucketName, content1, 'test-file.txt');

// Example 2: Upload to a folder
const content2 = Buffer.from('Document content', 'utf-8');
await client.uploadFile(dcslug, bucketName, content2, 'documents/my-doc.txt');

// Example 3: Upload actual file from disk
import * as fs from 'fs';
const fileContent = fs.readFileSync('./README.md');
await client.uploadFile(dcslug, bucketName, fileContent, 'files/README.md');

Multiple Files Upload

import { UthoObjectStorage } from '@utho-community/object-storage';

const client = new UthoObjectStorage({
  token: 'your-bearer-token'
});

const dcslug = 'innoida';
const bucketName = 'my-bucket';
const folderName = 'documents';

// Upload 10 files to a folder
for (let i = 1; i <= 10; i++) {
  const fileName = `file${i}.txt`;
  const content = `File ${i} - Created at ${new Date().toISOString()}`;
  const fileBuffer = Buffer.from(content, 'utf-8');
  const filePath = `${folderName}/${fileName}`;
  
  try {
    await client.uploadFile(dcslug, bucketName, fileBuffer, filePath);
    console.log(`✅ Uploaded: ${fileName}`);
  } catch (error) {
    console.error(`❌ Failed: ${fileName}`, error.message);
  }
}

See the examples folder for complete working examples:

  • single-file-upload.ts - Single file upload examples
  • multi-file-upload.ts - Multiple files upload example

API Reference

Upload Methods

// uploadFile() - Upload a file with full path (recommended)
await client.uploadFile(
  dcslug,       // Data center slug (e.g., 'innoida')
  bucketName,   // Bucket name
  fileBuffer,   // File content as Buffer
  'folder/file.txt'  // Full path: folder + filename
);

// putObject() - Alternative upload method
await client.putObject(
  dcslug,       // Data center slug (e.g., 'innoida')
  bucketName,   // Bucket name
  'file.txt',   // Filename
  content       // Content as string or Buffer
);

Bucket Management

// Create a new bucket
await client.createObjectStorage({
  dcslug: 'innoida',
  name: 'my-bucket',
  size: '10',          // Size in GB
  billing: 'Monthly'
});

// List all buckets
const buckets = await client.listObjectStorages('innoida');

// Get bucket details
const details = await client.getObjectStorageDetails('innoida', 'my-bucket');

// Delete bucket
await client.deleteObjectStorage('innoida', 'my-bucket');

// Check if bucket exists
const exists = await client.bucketExists('innoida', 'my-bucket');

File Operations

// Delete a file
await client.deleteFile('innoida', 'my-bucket', 'documents/old-file.txt');

// Delete a directory
await client.deleteDirectory('innoida', 'my-bucket', 'old-folder');

// Create a directory
await client.createDirectory('innoida', 'my-bucket', { path: 'new-folder' });

// Get shareable URL (1 hour expiry)
const url = await client.getSharableUrl('innoida', 'my-bucket', 'file.txt', '1h');

// Duration options: '30s', '15m', '1h', '7d', '1M', '1y', 'never'
const permanentUrl = await client.getSharableUrl('innoida', 'my-bucket', 'file.txt', 'never');

Access Key Management

// List access keys
const keys = await client.listAccessKeys('innoida');

// Create access key
await client.createAccessKey('innoida', { accesskey: 'my-access-key' });

// Modify access key status
await client.modifyAccessKey('innoida', 'key-name', { 
  accesskey: 'key-value',
  status: 'enable' // or 'disable', 'remove'
});

Authentication

Bearer Token (Recommended)

const client = new UthoObjectStorage({
  token: 'your-bearer-token'  // Get from Utho Dashboard → API
});

Access Key + Secret Key

const client = new UthoObjectStorage({
  accessKey: 'your-access-key',     // From Object Storage settings
  secretKey: 'your-secret-key'      // From Object Storage settings
});

Getting Credentials

Bearer Token:

  1. Login to Utho Dashboard
  2. Go to API section
  3. Generate new Bearer token

Access Keys:

  1. Login to Utho Dashboard
  2. Go to Object Storage → Select your bucket
  3. View or create access keys

Configuration Options

const client = new UthoObjectStorage({
  token: 'your-token',
  timeout: 60000,  // Optional: Request timeout in ms (default: 30000)
  endpoint: 'https://api.utho.com/v2'  // Optional: Custom API endpoint
});

Error Handling

try {
  await client.uploadFile('innoida', 'my-bucket', fileBuffer, 'documents/file.pdf');
  console.log('✅ Upload successful!');
} catch (error) {
  console.error('❌ Upload failed:', error.message);
  // Handle specific errors
  if (error.statusCode === 404) {
    console.error('Bucket not found');
  }
}

Important Notes

File Paths

  • Correct: 'folder/file.txt' - File goes to folder
  • Correct: 'file.txt' - File goes to root
  • Correct: 'docs/2024/report.pdf' - Nested folders

Known API Limitations

  • The listObjects() API may return empty results (Utho API limitation)
  • Files are uploaded successfully even if list returns empty
  • Verify uploads via Utho web console

Working Examples

Check the examples folder for complete working code:

  • single-file-upload.ts - Single file upload with different scenarios
  • multi-file-upload.ts - Upload 10 files to a folder

TypeScript Support

Full TypeScript definitions included:

import { 
  UthoObjectStorage, 
  UthoConfig, 
  ObjectStorage,
  AccessKey,
  ObjectInfo,
  ShareableDuration
} from '@utho-community/object-storage';

// Type-safe configuration
const config: UthoConfig = {
  token: 'your-token',
  timeout: 30000
};

const client = new UthoObjectStorage(config);

Requirements

  • Node.js >= 14.0.0
  • TypeScript >= 5.0.0 (for TypeScript projects)

Package Info

  • Dual Module Support: ESM and CommonJS
  • TypeScript Declarations: Full type definitions included
  • Dependencies: axios, form-data
  • Size: ~20KB (minified)

Support & Links

License

MIT License - see LICENSE file for details.

Author

The original author of Utho Object Storage SDK is Anwaarul Haque

Contributors

This project is maintained by the Utho Community.


Made with ❤️ for Utho.com developers