Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
9255875d83 | |||
346269d399 | |||
4bb6e2ef51 | |||
0ec7e1d6c6 | |||
bac986ac85 | |||
476ff5bbce |
13201
package-lock.json
generated
13201
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartbucket",
|
"name": "@pushrocks/smartbucket",
|
||||||
"version": "1.0.37",
|
"version": "1.0.40",
|
||||||
"description": "simple cloud independent object storage",
|
"description": "simple cloud independent object storage",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
@ -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,14 +63,16 @@ 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]);
|
||||||
|
} else {
|
||||||
|
completeFile = chunk;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
@ -78,6 +80,7 @@ export class Bucket {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
done.resolve();
|
done.resolve();
|
||||||
|
subscription.unsubscribe();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
await done.promise;
|
await done.promise;
|
||||||
|
@ -169,14 +169,15 @@ export class Directory {
|
|||||||
*/
|
*/
|
||||||
public async move() {
|
public async move() {
|
||||||
// TODO
|
// TODO
|
||||||
|
throw new Error('moving a directory is not yet implemented')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates a file within this directory
|
* creates a file within this directory
|
||||||
* @param relativePathArg
|
* @param relativePathArg
|
||||||
*/
|
*/
|
||||||
public async createFile(relativePathArg) {
|
public async createEmptyFile(relativePathArg: string) {
|
||||||
let completeFilePath: string = '';
|
const emtpyFile = await File.createFileFromString(this, relativePathArg, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// file operations
|
// file operations
|
||||||
|
@ -76,8 +76,8 @@ export class File {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async streamContent() {
|
public async streamContent() {
|
||||||
throw new Error('not yet implemented');
|
|
||||||
// TODO
|
// TODO
|
||||||
|
throw new Error('not yet implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user