Skip to content

This Node.js API provides a convenient way to interact with Minio for uploading, downloading, and managing objects

Notifications You must be signed in to change notification settings

samuelkago/nodejs-minio-api

Repository files navigation

Minio API in Node.js

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.

Table of Contents

Introduction

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.

Prerequisites

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.

Installation

You can install the Minio API for Node.js using npm:

npm install minio

Usage

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.

API Reference

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.

Examples

Here are some common examples of how to use the Minio API in Node.js:

  1. Create a Bucket:

    minioClient.makeBucket('my-bucket', 'us-east-1', (err) => {
      if (err) throw err;
      console.log('Bucket created successfully');
    });
  2. 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');
    });
  3. 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.

Contributing

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.

License

This Minio API for Node.js is licensed under the MIT License. See the LICENSE file for details.

About

This Node.js API provides a convenient way to interact with Minio for uploading, downloading, and managing objects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published