This README provides documentation for the Minio API in Node.js, which allows you to interact with the Minio object storage server using the Node.js programming language.
Minio is an open-source object storage server that is compatible with the Amazon S3 API. It allows you to store and manage large amounts of data in a distributed and scalable manner. This Node.js API provides a convenient way to interact with Minio for uploading, downloading, and managing objects.
Before you begin, ensure you have the following prerequisites:
- Node.js installed on your system.
- A running Minio server or access to a Minio instance. You will need the server's endpoint, access key, and secret key.
You can install the Minio API for Node.js using npm:
npm install minio
To use the Minio API in your Node.js application, you'll need to require the minio
module and initialize a client with your Minio server's configuration.
const Minio = require('minio');
const minioClient = new Minio.Client({
endPoint: 'your-minio-server.com',
port: 9000,
useSSL: false,
accessKey: 'your-access-key',
secretKey: 'your-secret-key',
});
Make sure to replace the placeholders with your Minio server's information.
The Minio API provides various methods for working with objects in your Minio bucket. Refer to the official Minio Node.js SDK documentation for detailed information on available methods and usage.
Here are some common examples of how to use the Minio API in Node.js:
-
Create a Bucket:
minioClient.makeBucket('my-bucket', 'us-east-1', (err) => { if (err) throw err; console.log('Bucket created successfully'); });
-
Upload an Object:
const fileStream = fs.createReadStream('path/to/local/file.txt'); minioClient.putObject('my-bucket', 'file.txt', fileStream, (err, etag) => { if (err) throw err; console.log('File uploaded successfully'); });
-
Download an Object:
minioClient.getObject('my-bucket', 'file.txt', (err, dataStream) => { if (err) throw err; dataStream.pipe(fs.createWriteStream('path/to/local/file.txt')); console.log('File downloaded successfully'); });
For more examples and use cases, please refer to the official Minio Node.js SDK examples.
Contributions to this Minio API for Node.js are welcome. If you find issues or have improvements to suggest, please open an issue or submit a pull request on the GitHub repository.
This Minio API for Node.js is licensed under the MIT License. See the LICENSE file for details.