Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hazratgs/online-storage-client

The library for working with online storage is similar to localStorage
https://github.com/hazratgs/online-storage-client

cloud-storage key-value kurtuba-storage localstorage storage

Last synced: about 2 months ago
JSON representation

The library for working with online storage is similar to localStorage

Awesome Lists containing this project

README

        

## online-storage
[![npm](https://img.shields.io/npm/v/npm.svg)](https://www.npmjs.com/package/online-storage)

The library for working with online storage is similar to localStorage

### Features
- Create token
- Refresh token
- Get value of a property from the storage
- Get all storage data
- Set key/value
- Remove element it storage
- Delete storage
- Create backup
- Get backup list
- Restoring the vault from a backup

## Install

npm install online-storage --save

#### Browser
online-storage work on all browsers.

#### Using

import onlineStorage from 'online-storage'

## API

#### Creating a token:
```js
onlineStorage.create()
```


View Response

```js
{
"token": "002cac23-aa8b-4803-a94f-3888020fa0df",
"connect": "5bf365e0-1fc0-11e8-85d2-3f7a9c4f742e",
"refreshToken": "5bf365e0-1fc0-11e8-85d2-3f7a9c4f742e"
}
```

#### Writing data to storage:
```js
onlineStorage.set({
name: 'hazratgs',
age: 25,
city: 'Derbent'
skills: ['javascript', 'react+redux', 'nodejs', 'mongodb']
})
```


View Response

```js
{
"status": true,
"message": "Successfully added"
}
```

#### Get property
```js
onlineStorage.get('name')
```


View Response

```js
"hazratgs"
```

#### Get all storage
```js
onlineStorage.get()
```


View Response

```js
{
name: 'hazratgs',
age: 25,
city: 'Derbent'
skills: ['javascript', 'react+redux', 'nodejs', 'mongodb']
}
```

#### Remove property
```js
onlineStorage.remove('name')
```


View Response

```js
{
"status": true,
"message": "Successfully deleted"
}
```

#### Delete storage
```js
onlineStorage.delete()
```


View Response

```js
{
"status": true,
"message": "Storage deleted"
}
```

#### Create backup
```js
onlineStorage.backup()
```


View Response

```js
{
"status": true
}
```

#### Get backup list storage
```js
onlineStorage.backupList()
```


View Response

```js
{
"status": true,
"data": ['Sun Mar 04 2018 19:39:42 GMT+0300 (MSK)']
}
```

#### Restoring the vault from a backup
```js
onlineStorage.backupRestore('Sun Mar 04 2018 19:39:42 GMT+0300 (MSK)')
```


View Response

```js
{
"status": true,
"message": "Successfully restored"
}
```

## License
MIT