This tool aims to simplify client upload or retrieve image files between Cloud and your application.
$ npm install progImage-tools
const ProgImageTools = require('progimage-tools');
/**
*
* @param {*} imagesBucketName - Bucket Name in your AWS S3
* @param {*} imagesTableName - Table name in your AWS DynamoDB
* @param {*} imageId - ImageID to retrieve (Partition key in imagesTableName)
* @returns
*/
let progImageTools = new ProgImageTools();
let imageUrl = await progImageTools.upload(
'images-bucket',
'Images',
'http://localhost:3000/dev/retrieve',
'cl8adv3uv00020yxpfuu7ccs4',
'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys...',
'demo description',
);
const ProgImageTools = require('progimage-tools');
/**
*
* @param {*} imagesBucketName - Bucket Name in your AWS S3
* @param {*} imagesTableName - Table name in your AWS DynamoDB
* @param {*} imageId - ImageID to retrieve (Partition key in imagesTableName)
* @param {*} imagesHostURL - Your API / Website that allow your client to call later when the unique imageId
* @param {*} imageFileBase64 - Image file in Base64 encoding (example: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQA...)
* @param {*} desc - Description of the image that your client is uploading
* @returns
*/
let progImageTools = new ProgImageTools();
let image = await progImageTools.retrieve(
'images-bucket',
'Images',
'imageId,
'cl8adv3uv00020yxpfuu7ccs4',
);