storeio
v1.0.2
Published
StoreIO is a TypeScript library for interacting with MinIO object storage, providing functionalities for uploading, downloading, and generating presigned URLs.
Downloads
1
Readme
StoreIO - MinIO Storage Library
StoreIO is a TypeScript library for interacting with MinIO object storage, providing functionalities for uploading, downloading, and generating presigned URLs.
Features
- Upload files to MinIO
- Download files from MinIO
- Convert a URL to a Buffer
- Generate a presigned URL for file access
Installation
npm install storeioUsage
Import StoreIO
import StoreIO from 'storeio';Initialize StoreIO
const store = new StoreIO({
endPoint: 'play.min.io',
port: 9000,
useSSL: true,
accessKey: 'your-access-key',
secretKey: 'your-secret-key',
bucketName: 'your-bucket',
});Upload a File
const fileName = 'example.txt';
const fileBuffer = Buffer.from('Hello, MinIO!');
const mimeType = 'text/plain';
await store.uploadFile(fileName, fileBuffer, mimeType);Download a File
const fileStream = await store.downloadFile('example.txt');Get a Presigned URL
const url = await store.getPresignedUrl('example.txt');
console.log('Presigned URL:', url);Convert URL to Buffer
const buffer = await store.urlToBuffer('https://example.com/image.jpg');License
MIT
