|
7 | 7 |  |
8 | 8 |  |
9 | 9 |
|
10 | | -Storage Manager for cross platform e.g AWS S3 GStorage and file-system |
| 10 | +> Node.js idiomatic client for [Cloud Storage] |
| 11 | +
|
| 12 | +[Node - Storage Pipe Manager](https://www.npmjs.com/package/node_storage_manager) allows world-wide |
| 13 | +storage and retrieval of any amount of data at any time. You can use Google |
| 14 | +`Cloud Storage`, `AWS S3 Bucket` for a range of scenarios including serving website content, |
| 15 | +storing data for archival and disaster recovery, or distributing large data |
| 16 | +objects to users via direct download. Storage Pipe Manager is a Pipe Factory that allow you easily switch between `Google CLoud` `AWS S3` and `FS` without breaking anything or any extra configurations |
| 17 | + |
| 18 | +**Table of contents:** |
| 19 | + |
| 20 | + |
| 21 | +* [Quickstart](#quickstart) |
| 22 | + * [Before you begin](#before-you-begin) |
| 23 | + * [Installing the client library](#installing-the-client-library) |
| 24 | + * [Using the client library](#using-the-client-library) |
| 25 | +* [Samples](#samples) |
| 26 | +* [Versioning](#versioning) |
| 27 | +* [Contributing](#contributing) |
| 28 | +* [License](#license) |
| 29 | + |
| 30 | +## Quickstart |
| 31 | + |
| 32 | +### Before you begin |
| 33 | +Make Sure to define your credentials using enviromental vairable for `AWS`, `Google` and `FS` in your `.zshrc` or `.bashrc` file |
| 34 | + |
| 35 | +Google Bucket Declaration |
| 36 | +```bash |
| 37 | +export GOOGLE_APPLICATION_CREDENTIALS=/Users/nitrocode/comics-eagle-39849343-837483483.json |
| 38 | +``` |
| 39 | +AWS S3 Declaration |
| 40 | +```bash |
| 41 | +export AWS_ACCESS_KEY_ID=284893748923yuwfhsdkfjshkfjh |
| 42 | +export AWS_SECRET_ACCESS_KEY=982u289432u48jsdfkjsr3894 |
| 43 | +AWS_SESSION_TOKEN (optional) |
| 44 | +``` |
| 45 | + |
| 46 | +Local FS Declaration |
| 47 | +```bash |
| 48 | +export MOUNT_POINT=/Users/nitrocode/bucket/ |
| 49 | +``` |
| 50 | +Would advice to declare all at once for easy switch between clients |
| 51 | + |
| 52 | + |
| 53 | +### Installing the client library |
| 54 | + |
| 55 | +```bash |
| 56 | +npm i node_storage_manager |
| 57 | +``` |
| 58 | + |
| 59 | + |
| 60 | +### Using the client library on GCLOUD |
| 61 | +#####node_storage_manager allows you to switch between clients easily without reconfigurations |
| 62 | +```javascript |
| 63 | + // Imports the node_storage_manager library |
| 64 | + const Storage = require('node_storage_manager'); |
| 65 | + |
| 66 | + // Set Storage Instance between AWS,GCLOUD and FS |
| 67 | + let StorageInstance = Storage.getInstance('GCLOUD'); |
| 68 | + |
| 69 | + /** |
| 70 | + * TODO(developer): Uncomment these variables before running the sample. |
| 71 | + */ |
| 72 | + // const bucketName = 'bucket-name'; |
| 73 | + |
| 74 | + async function download() { |
| 75 | + // Creates the new bucket |
| 76 | + await StorageInstance.download('bucket', 'file', 'destination'); |
| 77 | + console.log(`Bucket ${bucketName} created.`); |
| 78 | + } |
| 79 | + |
| 80 | + createBucket().catch(console.error); |
| 81 | + |
| 82 | +``` |
| 83 | + |
| 84 | +### Using the client library on AWS |
| 85 | +```javascript |
| 86 | + // Imports the node_storage_manager library |
| 87 | + const Storage = require('node_storage_manager'); |
| 88 | + |
| 89 | + // Set Storage Instance between AWS,GCLOUD and FS |
| 90 | + let StorageInstance = Storage.getInstance('AWS'); |
| 91 | + |
| 92 | + /** |
| 93 | + * TODO(developer): Uncomment these variables before running the sample. |
| 94 | + */ |
| 95 | + // const bucketName = 'bucket-name'; |
| 96 | + |
| 97 | + async function download() { |
| 98 | + // Creates the new bucket |
| 99 | + await StorageInstance.download('bucket', 'file', 'destination'); |
| 100 | + console.log(`Bucket ${bucketName} created.`); |
| 101 | + } |
| 102 | + |
| 103 | + createBucket().catch(console.error); |
| 104 | + |
| 105 | +``` |
0 commit comments