1.0.5 • Published 5 years ago

easy-save v1.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Easy Save

npm.io npm.io Build Status

Easy Save is a wrapper for saving files to local disk or AWS S3 Currently receives only base64 file

Installation Instructions

npm install --save easy-save

How to Use

  1. First import the easy save
import EasySave from 'easy-save';
  1. Construct Object
const newConnect  =  new  EasySave({
		AWS_S3_ACCESS_KEY:  'any',
		AWS_S3_SECRET:  'any'
	}, 'aws', {
		bucket:  'BucketExample',
		folder:  'Folder'
	});
  1. Send File
newConnect.save(base64pic)
	.then(res  => {
		console.log('Save with Success');
	})
	.catch (err  => {
		console.log('Error on save file');
	})

Params on construct

const newConnect  =  new  EasySave(
	params, 
	local,
	target
);

params

// if you choose AWS 
{
	AWS_S3_ACCESS_KEY:  'Access Key from Amazon',
	AWS_S3_SECRET:  'Secret from Amazon'
}

If you choose save file to disk, declare the full disk path, example: /var/www

local

Choose two options: aws or local

target

// if you choose AWS 
{
	bucket:  'BucketExample',
	folder:  'Folder'
}

If you choose to save file to disk, declare a folder to save the file. In case folder does not exist the Easy Save creates. Example: folderExample

Methods

Save

Method to save file on aws or disc.

newConnect.save(base64pic, type)
  • Base64pic - Receive base 64 string
  • type - Type file, temporarily receives only base64

Return promises with result.

Get Method

Methods that return previously declared values

newConnect.getType()
newConnect.getTarget()
newConnect.getParams()

Return value that has already been declared

Set Method

Methods that edit the value already declared

newConnect.setType('New Value');
newConnect.setTarget('New Value');
newConnect.setParams('New Value');

Does not return value

Questions

https://github.com/DotAmzi/easy-save/issues

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago