aws-s3-async

AWS S3 helper package for async

aws-s3-async

AWS S3 helper package for async. (callback-style functions to async functions)

I will add them one by one if necessary. Not all features are implemented. I will also provide additional convenience features.

install

npm install aws-s3-async --save

Implemented Features

  • getObjectAsync(params: GetObjectRequest, fileName: string): Promise<string>
const FILE_NAME = "/tmp/temp.jpg";
await getObjectAsync({Bucket: "BUCKET_NAME", Key: "KEY"}, FILE_NAME)
const image = fs.readfilesync(FILE_NAME);
  • putObjectAsync(params: PutObjectRequest, fileName: string)
const FILE_NAME = "/tmp/temp.jpg";
await putObjectAsync({Bucket: "BUCKET_NAME", Key: "KEY"}, FILE_NAME)
  • listObjectsAsync(params: ListObjectsRequest)
const params: ListObjectsRequest  = {Bucket: "BUCKET_NAME", Prefix: "PREFIX", Marker: "START_OBJECT"};
const result = await listObjectsAsync(params);
console.info(JSON.stringify(result, null, 2));
  • listAllKeysAsync(params: ListObjectsRequest): Promise<string[]> : Promise style
const result = await listAllKeysAsync({Bucket: "BUCKET_NAME", Prefix: "PREFIX"});
console.info(JSON.stringify(result, null, 2));
  • listAllKeysRx(params: ListObjectsRequest): Rx.Observable<any> : ReactiveX style
await listAllKeysRx({Bucket: "BUCKET_NAME", Prefix: "PREFIX"})
    .map(console.info)
    .toPromise();
  • listAllKeys(params:ListObjectsRequest , nextFunction: (data: any) => void) : Callback style
    await listAllKeys({Bucket: "BUCKET_NAME", Prefix: "PREFIX"}, console.info);

Author

Yun.Seok-Joon

License

Toggler is available under the MIT license. See the LICENSE file for more info.

HomePage

https://github.com/DevStarSJ/aws-s3-async#readme

Repository

git+https://github.com/DevStarSJ/aws-s3-async.git


上一篇:custom-guider
下一篇:nn-cli

公众号

欢迎 JavaScript 爱好者