fix(core): update
This commit is contained in:
20
readme.md
20
readme.md
@@ -1,10 +1,10 @@
|
||||
# @push.rocks/smartbucket
|
||||
|
||||
A TypeScript library that offers simple, cloud-independent object storage with features like bucket creation, file management, and directory management.
|
||||
A TypeScript library for cloud-independent object storage, providing features like bucket creation, file and directory management, and data streaming.
|
||||
|
||||
## Install
|
||||
|
||||
To install `@push.rocks/smartbucket`, you need to have Node.js and npm (Node Package Manager) installed on your system. If you have them installed, you can add `@push.rocks/smartbucket` to your project by running the following command in your project's root directory:
|
||||
To install `@push.rocks/smartbucket`, you need to have Node.js and npm (Node Package Manager) installed. If they are installed, you can add `@push.rocks/smartbucket` to your project by running the following command in your project's root directory:
|
||||
|
||||
```bash
|
||||
npm install @push.rocks/smartbucket --save
|
||||
@@ -14,7 +14,7 @@ This command will download and install `@push.rocks/smartbucket` along with its
|
||||
|
||||
## Usage
|
||||
|
||||
`@push.rocks/smartbucket` is a TypeScript module designed to provide simple cloud-independent object storage functionality. It wraps various cloud storage providers such as AWS S3, Google Cloud Storage, and others, offering a unified API to manage storage buckets and objects within those buckets.
|
||||
`@push.rocks/smartbucket` is a TypeScript module designed to provide simple cloud-independent object storage functionality. It wraps various cloud storage providers such as AWS S3, Google Cloud Storage, and others, offering a unified API to manage storage buckets and objects within those buckets.
|
||||
|
||||
In this guide, we will delve into the usage of SmartBucket, covering its full range of features from setting up the library to advanced usage scenarios.
|
||||
|
||||
@@ -49,7 +49,7 @@ const mySmartBucket = new SmartBucket({
|
||||
accessKey: "yourAccessKey",
|
||||
accessSecret: "yourSecretKey",
|
||||
endpoint: "yourEndpointURL",
|
||||
port: 443, // Default is 443, could be customized for specific endpoint
|
||||
port: 443, // Default is 443, can be customized for specific endpoint
|
||||
useSsl: true // Defaults to true
|
||||
});
|
||||
```
|
||||
@@ -190,7 +190,7 @@ async function writeFileStream(bucketName: string, filePath: string, readableStr
|
||||
// Create a readable stream from a string
|
||||
const readable = new Readable();
|
||||
readable.push('Hello world streamed as a file!');
|
||||
readable.push(null); // Indicates end of the stream
|
||||
readable.push(null); // End of stream
|
||||
|
||||
// Use the function
|
||||
writeFileStream("exampleBucket", "path/to/streamedObject.txt", readable);
|
||||
@@ -198,9 +198,9 @@ writeFileStream("exampleBucket", "path/to/streamedObject.txt", readable);
|
||||
|
||||
### Working with Directories
|
||||
|
||||
`@push.rocks/smartbucket` abstracts directories within buckets for easier object management. You can create, list, and delete directories using the `Directory` class.
|
||||
`@push.rocks/smartbucket` offers abstractions for directories within buckets for easier object management. You can create, list, and delete directories using the `Directory` class.
|
||||
|
||||
Here's how to list the contents of a directory:
|
||||
To list the contents of a directory:
|
||||
|
||||
```typescript
|
||||
async function listDirectoryContents(bucketName: string, directoryPath: string) {
|
||||
@@ -254,11 +254,11 @@ createFileInDirectory("exampleBucket", "some/directory", "newfile.txt", "Hello,
|
||||
|
||||
#### Bucket Policies
|
||||
|
||||
Manage bucket policies to control access permissions. This feature is dependent on the policies provided by the storage service (e.g., AWS S3, MinIO).
|
||||
Manage bucket policies to control access permissions. This feature depends on the policies provided by the storage service (e.g., AWS S3, MinIO).
|
||||
|
||||
#### Object Metadata
|
||||
|
||||
You can retrieve and modify object metadata. Metadata can be useful for storing additional information about an object.
|
||||
Retrieve and modify object metadata. Metadata can be useful for storing additional information about an object.
|
||||
|
||||
To retrieve metadata:
|
||||
|
||||
@@ -308,8 +308,6 @@ Remember, each cloud provider has specific features and limitations. `@push.rock
|
||||
|
||||
This guide covers the basic to advanced scenarios of using `@push.rocks/smartbucket`. For further details, refer to the API documentation and examples.
|
||||
|
||||
|
||||
|
||||
## 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.
|
||||
|
Reference in New Issue
Block a user