fix(core): update
This commit is contained in:
parent
178c360b89
commit
476ff5bbce
@ -50,7 +50,7 @@ export class Bucket {
|
|||||||
/**
|
/**
|
||||||
* store file
|
* store file
|
||||||
*/
|
*/
|
||||||
public async fastStore(pathArg: string, fileContent: string) {
|
public async fastStore(pathArg: string, fileContent: string | Buffer): Promise<void> {
|
||||||
const streamIntake = new plugins.streamfunction.Intake();
|
const streamIntake = new plugins.streamfunction.Intake();
|
||||||
const putPromise = this.smartbucketRef.minioClient
|
const putPromise = this.smartbucketRef.minioClient
|
||||||
.putObject(this.name, pathArg, streamIntake.getReadable())
|
.putObject(this.name, pathArg, streamIntake.getReadable())
|
||||||
@ -63,11 +63,11 @@ export class Bucket {
|
|||||||
/**
|
/**
|
||||||
* get file
|
* get file
|
||||||
*/
|
*/
|
||||||
public async fastGet(pathArg: string) {
|
public async fastGet(pathArg: string): Promise<Buffer> {
|
||||||
const done = plugins.smartpromise.defer();
|
const done = plugins.smartpromise.defer();
|
||||||
let completeFile: Buffer;
|
let completeFile: Buffer;
|
||||||
const replaySubject = await this.fastGetStream(pathArg);
|
const replaySubject = await this.fastGetStream(pathArg);
|
||||||
replaySubject.subscribe(
|
const subscription = replaySubject.subscribe(
|
||||||
(chunk) => {
|
(chunk) => {
|
||||||
if (completeFile) {
|
if (completeFile) {
|
||||||
completeFile = Buffer.concat([completeFile, chunk]);
|
completeFile = Buffer.concat([completeFile, chunk]);
|
||||||
@ -78,6 +78,7 @@ export class Bucket {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
done.resolve();
|
done.resolve();
|
||||||
|
subscription.unsubscribe();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
await done.promise;
|
await done.promise;
|
||||||
|
Loading…
Reference in New Issue
Block a user