Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@tweedegolf/sab-adapter-minio
Advanced tools
Provides an abstraction layer for interacting with MinIO cloud storage service.
An adapter that provides an abstraction layer over the API of the MinIO cloud storage service.
This adapter is one of the adapters that is meant to be used as a plugin of the Storage Abstraction package. However it can be used standalone as well, see below.
The API of the adapter abstracts away the differences between the API's of cloud storage services. The API only supports the basic, most commonly used cloud service operations such as creating a bucket, storing files and so on.
It is also possible to access all the specific functionality of the cloud service API through the service client of the adapter, see here.
If you are new to the Storage Abstraction library you may want to read this first.
import { Storage, StorageType } from "@tweedegolf/storage-abstraction";
const configuration = {
type: StorageType.MINIO,
port: 9000,
useSSL: true,
region: "us-east-1",
endPoint: "play.min.io",
accessKey: "Q3AM3UQ867SPQQA43P2F",
secretKey: "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG",
};
const storage = new Storage(configuration);
const result = await storage.listBuckets();
console.log(result);
The Storage class is cloud service agnostic and doesn't know anything about the adapter it uses and adapters are completely interchangeable. It only expects the adapter to have implemented all methods of the IAdapter
interface, see the API.
When you create a Storage instance it checks the mandatory type
key in the configuration object and then loads the appropriate adapter module automatically from your node_modules folder using require
. For more information please read this.
The configuration object that you pass to the Storage constructor is forwarded to the constructor of the adapter.
The Storage constructor is only interested in the type
key of the configuration object, all other keys are necessary for configuring the adapter.
The Storage constructor expects the configuration to be of type StorageAdapterConfig
.
The adapter expects the configuration to be of type AdapterConfig
or a type that extends this type.
export interface AdapterConfig {
bucketName?: string;
[id: string]: any; // any mandatory or optional key
}
export interface StorageAdapterConfig extends AdapterConfig {
type: string;
}
The type of the configuration object for this adapter:
export interface AdapterConfigMinio extends AdapterConfig {
endPoint: string;
accessKey: string;
secretKey: string;
region?: string;
useSSL?: boolean;
port?: number;
}
Examples with configuration object:
const s = new Storage({
type: StorageType.MINIO,
endPoint: "play.min.io",
accessKey: "your-access-key",
secretKey: "your-secret-key",
});
const s = new Storage({
type: StorageType.MINIO,
endPoint: "play.min.io",
accessKey: "your-access-key",
secretKey: "your-secret-key",
bucketName: "the-buck",
port: 9000,
});
const s = new Storage({
type: StorageType.MINIO,
endPoint: "play.min.io",
accessKey: "your-access-key",
secretKey: "your-secret-key",
port: 9000,
});
Same examples with configuration url:
const s = new Storage(
"minio://your-access-key:your-secret-key?endPoint=play.min.io"
const s = new Storage(
"minio://your-access-key:your-secret-key@the-buck:9000?endPoint=play.min.io"
const s = new Storage(
"minio://your-access-key:your-secret-key:9000?endPoint=play.min.io"
);
You can pass the port using a colon but you can also pass it as a query param, the following urls are equal because the searchParams
object will be flattened into the config object:
const s = new Storage("minio://your-access-key:your-secret-key@the-buck:9000");
const p = {
protocol: "minio",
username: "your-access-key",
password: "your-secret-key",
host: "the-buck",
port: "9000",
path: null,
searchParams: null,
};
// same as:
const s = new Storage("minio://your-access-key:your-secret-key@the-buck?port=9000");
const p = {
protocol: "minio",
username: "your-access-key",
password: "your-secret-key",
host: "the-buck",
port: null,
path: null,
searchParams: { port: "9000" },
};
// both are converted to:
const c: AdapterConfigMinio = {
type: "minio",
accessKey: "your-access-key";
secretKey: "your-secret-keu";
bucketName: "the-buck",
port: 9000;
}
For more information about configuration urls please read this.
You can also use the adapter standalone, without the need to create a Storage instance:
import { AdapterMinio } from "@tweedegolf/sab-adapter-minio";
const adapter = new AdapterMinio({
endPoint: "play.min.io",
accessKey: "Q3AM3UQ867SPQQA43P2F",
secretKey: "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG",
});
const result = await adapter.listBuckets();
console.log(result);
For a complete description of the Adapter API see this part documentation of the Storage Abstraction package readme.
FAQs
Provides an abstraction layer for interacting with MinIO cloud storage service.
We found that @tweedegolf/sab-adapter-minio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.