Revise README with detailed usage examples and add local Claude settings
- Revamped README: reorganized content, added emojis and clearer headings for install, getting started, bucket/file/directory operations, streaming, metadata, trash/recovery, locking, and advanced configuration.
- Added many concrete code examples for SmartBucket, Bucket, Directory, File, streaming (node/web), RxJS replay subjects, metadata handling, trash workflow, file locking, magic-bytes detection, JSON operations, and cleaning bucket contents.
- Included testing instructions (pnpm test) and a Best Practices section with recommendations for strict mode, streaming, metadata, trash usage, and locking.
- Added .claude/settings.local.json to include local Claude configuration and tool permissions.
- No source code or public API changes; documentation and local tooling config only.
## 2025-08-15 - 3.3.8 - fix(tests)
## 2025-08-15 - 3.3.8 - fix(tests)
Update tests to use @git.zone/tstest, upgrade dependencies, remove GitLab CI and add local CI/workspace config
Update tests to use @git.zone/tstest, upgrade dependencies, remove GitLab CI and add local CI/workspace config
"description":"A TypeScript library providing a cloud-agnostic interface for managing object storage with functionalities like bucket management, file and directory operations, and advanced features such as metadata handling and file locking.",
"description":"A TypeScript library providing a cloud-agnostic interface for managing object storage with functionalities like bucket management, file and directory operations, and advanced features such as metadata handling and file locking.",
A comprehensive TypeScript library for cloud-agnostic object storage offering bucket management, file operations, and advanced data streaming.
> A powerful, cloud-agnostic TypeScript library for object storage with advanced features like file locking, metadata management, and intelligent trash handling.
## Install
## Install 📦
To install `@push.rocks/smartbucket`, ensure you have Node.js and npm installed. Then, run the following command in your project directory:
To install `@push.rocks/smartbucket`, run:
```bash
```bash
npm install @push.rocks/smartbucket --save
npm install @push.rocks/smartbucket --save
```
```
This command will add `@push.rocks/smartbucket` to your project's dependencies and install it along with its requirements in the `node_modules` directory.
Or if you're using pnpm (recommended):
## Usage
```bash
pnpm add @push.rocks/smartbucket
```
## Usage 🚀
### Introduction
### Introduction
`@push.rocks/smartbucket` provides a robust set of features to manage cloud storage operations in a cloud-agnostic manner. By leveraging this library, you can seamlessly interact with object storage services like AWS S3, without being tied to any vendor-specific implementations. This library not only abstracts basic file operations but also integrates advanced capabilities such as metadata management, data streaming, file locking, and bucket policies, all through a simplified API.
`@push.rocks/smartbucket` provides a unified, cloud-agnostic API for object storage operations across major providers like AWS S3, Google Cloud Storage, MinIO, and more. It abstracts away provider-specific complexities while offering advanced features like metadata management, file locking, streaming operations, and intelligent trash management.
### Table of Contents
### Table of Contents
1. [Setting Up](#setting-up)
1. [🏁 Getting Started](#-getting-started)
2. [Working with Buckets](#working-with-buckets)
2. [🗂️ Working with Buckets](#️-working-with-buckets)
- [Listing Directories and Files](#listing-directories-and-files)
- [Managing Files in Directories](#managing-files-in-directories)
5. [Advanced Features](#advanced-features)
- [Bucket Policies](#bucket-policies)
- [Metadata Management](#metadata-management)
- [File Locking](#file-locking)
- [Trash Management](#trash-management)
6. [Cloud Agnosticism](#cloud-agnosticism)
### Setting Up
### 🏁 Getting Started
Begin by importing the necessary classes from the `@push.rocks/smartbucket` package into your TypeScript file. Create an instance of `SmartBucket` with your storage configuration:
First, set up your storage connection:
```typescript
```typescript
import{
import{SmartBucket}from'@push.rocks/smartbucket';
SmartBucket,
Bucket,
Directory,
File
}from'@push.rocks/smartbucket';
constmySmartBucket=newSmartBucket({
// Initialize with your cloud storage credentials
accessKey:"yourAccessKey",
constsmartBucket=newSmartBucket({
accessSecret:"yourSecretKey",
accessKey:'your-access-key',
endpoint:"yourEndpointURL",
accessSecret:'your-secret-key',
endpoint:'s3.amazonaws.com',// Or your provider's endpoint
port: 443,
port: 443,
useSsl: true
useSsl: true,
region:'us-east-1'// Optional, defaults to 'us-east-1'
});
});
```
```
Replace `"yourAccessKey"`, `"yourSecretKey"`, and `"yourEndpointURL"` with actual data specific to your cloud provider.
### 🗂️ Working with Buckets
### Working with Buckets
#### Creating Buckets
#### Creating a New Bucket
Creating a bucket involves invoking the `createBucket` method. Note that bucket names are unique and follow the rules of the cloud provider:
While the library uses cloud-provider capabilities like AWS SDK to list existing buckets, `smartbucket` is aimed at simplifying content management within them.
#### Deleting Buckets
To delete a bucket, simply call the `removeBucket` function:
console.log(`File ${filePath} restored from trash.`);
}
trashAndRestoreFile("myBucket","example.txt");
```
```
### Cloud Agnosticism
### ☁️ Cloud Provider Support
`@push.rocks/smartbucket` supports a multitude of cloud providers, enhancing flexibility in adopting different cloud strategies without the need for extensive code rewrite. It offers a uniform interface allowing to perform operations seamlessly between different storage solutions such as AWS S3, Google Cloud Storage, and more. This aspect empowers organizations to align their storage decisions with business needs rather than technical constraints.
SmartBucket works seamlessly with:
By following this guide, you should be well-equipped to handle cloud storage operations using the `@push.rocks/smartbucket` library. Diligently constructed code examples elucidate the extensive functionalities offered by the library, aligned with best practices in cloud storage. For a deeper dive into any specific feature, refer to the comprehensive documentation provided with the library and the official documentation of the cloud providers you are integrating with.
- ✅ **AWS S3** - Full compatibility with S3 API
- ✅ **Google Cloud Storage** - Via S3-compatible API
1.**Always use strict mode** for critical operations to catch errors early
2.**Implement proper error handling** for network and permission issues
3.**Use streaming** for large files to optimize memory usage
4.**Leverage metadata** for organizing and searching files
5.**Enable trash mode** for important data to prevent accidental loss
6.**Lock files** during critical operations to prevent race conditions
7.**Clean up resources** properly when done
## License and Legal Information
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
description:'A TypeScript library providing a cloud-agnostic interface for managing object storage with functionalities like bucket management, file and directory operations, and advanced features such as metadata handling and file locking.'
description:'A TypeScript library providing a cloud-agnostic interface for managing object storage with functionalities like bucket management, file and directory operations, and advanced features such as metadata handling and file locking.'
}
}
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.