0.0.3 • Published 12 months ago
bucket-aws-sdk v0.0.3
bucket-aws-sdk
Basic Implementation of the Local Bucket
Installation
To install the bucket-aws-sdk
package, run the following command:
npm install bucket-aws-sdk
Usage
Here is an example of how to use the LocalBucket class:
const LocalBucket = require('bucket-aws-sdk');
// Create an instance of the LocalBucket
const bucket = new LocalBucket('username');
// Create an account
bucket.createAccount('password');
// Login to the account
bucket.login('password');
// Save a file
bucket.saveFile({ name: 'file.txt', contents: 'Hello, world!' });
// Get a list of files
const files = bucket.getFiles();
console.log(files);
// Get file statistics
const fileStats = bucket.getFilesStats();
console.log(fileStats);
// Logout from the account
bucket.logout();
API
LocalBucket
The LocalBucket class represents a local bucket for storing files.
Constructor
- new LocalBucket(userName: string): Creates a new instance of the LocalBucket class with the specified userName. Methods
- createAccount(password: string): boolean: Creates a new account with the provided password. Returns true on success.
- login(password: string): boolean: Logs in to the account with the provided password. Returns true on successful authentication.
- logout(): boolean: Logs out from the current account. Returns true on success.
- saveFile(file: { name: string, contents: string }): boolean: Saves a file with the specified name and contents to the bucket. Returns true if the file was saved successfully.
- getFiles(): string[]: Retrieves a list of files in the bucket. Returns an array of file names.
- getFilesStats(): { name: string, size: number, created: Date, modified: Date }[]: Retrieves statistics for each file in the bucket. Returns an array of file statistics objects, including name, size, created (birth time), and modified (last modified time).
Issues
If you encounter any issues or have any questions, please create an issue on the GitHub repository.
Versioning
This project follows the principles of Semantic Versioning.
Contributing
Contributions are welcome! Please feel free to submit a pull request.
License
This project is licensed under the ISC License.