Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
703bfe7fe8 | |||
545f5d35f5 | |||
070eb559b9 | |||
d07e30d7fb | |||
2293ad69e1 | |||
0a150a8a09 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@pushrocks/smarts3",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.10",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@pushrocks/smarts3",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.10",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@pushrocks/smartfile": "^9.0.3",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smarts3",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.10",
|
||||
"private": false,
|
||||
"description": "create an s3 endpoint that maps to a local directory",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -15,13 +15,7 @@ tap.test('should create a smarts3 instance and run it', async toolsArg => {
|
||||
});
|
||||
|
||||
tap.test('should be able to access buckets', async () => {
|
||||
const smartbucketInstance = new plugins.smartbucket.SmartBucket({
|
||||
endpoint: 'localhost',
|
||||
port: 3000,
|
||||
useSsl: false,
|
||||
accessKey: 'S3RVER',
|
||||
accessSecret: 'S3RVER'
|
||||
});
|
||||
const smartbucketInstance = new plugins.smartbucket.SmartBucket(await testSmarts3Instance.getS3Descriptor());
|
||||
const bucket = await smartbucketInstance.createBucket('testbucket');
|
||||
const baseDirectory = await bucket.getBaseDirectory();
|
||||
await baseDirectory.fastStore('subdir/hello.txt', 'hi there!');
|
||||
|
20
ts/index.ts
20
ts/index.ts
@ -16,12 +16,6 @@ export class Smarts3 {
|
||||
|
||||
// INSTANCE
|
||||
public options: ISmarts3ContructorOptions;
|
||||
public dataForClient = {
|
||||
s3AccessKey: 'S3RVER',
|
||||
s3AccessSecret: 'S3RVER',
|
||||
port: 3000,
|
||||
useSsl: false
|
||||
}
|
||||
public s3Instance: plugins.s3rver;
|
||||
|
||||
constructor(optionsArg: ISmarts3ContructorOptions) {
|
||||
@ -50,14 +44,20 @@ export class Smarts3 {
|
||||
|
||||
public async getS3Descriptor(): Promise<plugins.smartbucket.ISmartBucketConfig> {
|
||||
return {
|
||||
accessKey: this.dataForClient.s3AccessKey,
|
||||
accessSecret: this.dataForClient.s3AccessSecret,
|
||||
accessKey: 'S3RVER',
|
||||
accessSecret: 'S3RVER',
|
||||
endpoint: 'localhost',
|
||||
port: this.dataForClient.port,
|
||||
useSsl: this.dataForClient.useSsl,
|
||||
port: this.options.port,
|
||||
useSsl: false,
|
||||
}
|
||||
}
|
||||
|
||||
public async createBucket(bucketNameArg: string) {
|
||||
const smartbucketInstance = new plugins.smartbucket.SmartBucket(await this.getS3Descriptor());
|
||||
const bucket = await smartbucketInstance.createBucket(bucketNameArg);
|
||||
return bucket;
|
||||
}
|
||||
|
||||
public async stop() {
|
||||
await this.s3Instance.close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user