@biorate/minio
v1.87.1
Published
Minio connector
Downloads
183
Readme
Minio
Minio connector
Examples:
import { inject, container, Types, Core } from '@biorate/inversion';
import { IConfig, Config } from '@biorate/config';
import { MinioConnector, MinioConfig } from '@biorate/minio';
class Root extends Core() {
@inject(MinioConnector) public connector: MinioConnector;
}
container.bind<IConfig>(Types.Config).to(Config).inSingletonScope();
container.bind<MinioConnector>(MinioConnector).toSelf().inSingletonScope();
container.bind<Root>(Root).toSelf().inSingletonScope();
container.get<IConfig>(Types.Config).merge({
Minio: [
{
name: 'connection',
options: {
endPoint: 'localhost',
port: 9000,
accessKey: 'admin',
secretKey: 'minioadmin',
useSSL: false,
},
},
],
});
(async () => {
const root = container.get<Root>(Root);
await root.$run();
await root.connector!.current!.makeBucket('test', 'test');
await root.connector!.current!.putObject(
'test',
'test.file',
Buffer.from('Hello world!'),
));
root.connector!.current!.getObject('test', 'test.file', (e, stream) => {
let data = '';
stream
.on('data', (chunk) => (data += chunk.toString('utf8')))
.on('end', () => console.log(data)); // 'Hello world!'
});
})();
Learn
- Documentation can be found here - docs.
Release History
See the CHANGELOG
License
Copyright (c) 2021-present Leonid Levkin (llevkin)