Gathering detailed insights and metrics for @ikigai-gfc/tiny-storage-client
Gathering detailed insights and metrics for @ikigai-gfc/tiny-storage-client
Gathering detailed insights and metrics for @ikigai-gfc/tiny-storage-client
Gathering detailed insights and metrics for @ikigai-gfc/tiny-storage-client
npm install @ikigai-gfc/tiny-storage-client
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
This is a fork of tiny-storage-client v1.0.2 to be compliant with node versions older than 16.0.0.
Some modifications have been added to the original code (wrong import names, this kind of stuff).
High availability, Performances, and Simplicity are the main focus of this tiny Node client to request AWS S3 API or the OpenStack Swift Object Storage API. It was initially made to request OVHCloud, but it can be used for any Server/Cloud provider.
uploadFile
, deleteFile
, listFiles
, downloadFile
and request
for custom requests.ListObjects
and Errors
).Install and setup in less than 2 minutes:
Swift API | S3 API | Method | Description |
---|---|---|---|
✅ example | ✅ example | uploadFile | Upload a file from a Buffer or file absolute path. |
✅ example | ✅ example | downloadFile | Download a file as Buffer or Stream |
✅ example | ✅ example | deleteFile | Delete a file |
❌ | ✅ example | deleteFiles | Bulk delete files (1000 max/per request) |
✅ example | ✅ example | listFiles | List files (1000 max/per requests) use query parameters for pagination |
✅ example | ✅ example | getFileMetadata | Fetch custom metadatas |
✅ example | ✅ example | setFileMetadata | Set custom file metadatas |
❌ | ✅ example | headBucket | Determine if a bucket exists and you have permission to access it |
❌ | ✅ example | listBuckets | Returns a list of all buckets owned by the authenticated sender of the request. |
✅ example | ✅ example | request | Create custom requests |
✅ example | ❌ | connection | Connection is required only for Openstack Swift Object storage to get a unique auth token |
❌ | ✅ example | Bucket Alias | Simplify requests by using bucket alias |
The following exemple is an initialisation of the SDK client with a list of S3 credentials and a request to download a file. If something goes wrong when downloading the file, the SDK will switch storage and retry to download with the second credentials. As soon as the first storage is available, the SDK returns to the main storage
1const storageClient = require('tiny-storage-client');
2
3const s3storage = storageClient([{
4 accessKeyId : 'accessKeyId',
5 secretAccessKey: 'secretAccessKey',
6 url : 's3.gra.io.cloud.ovh.net',
7 region : 'gra'
8 },
9 {
10 accessKeyId : 'accessKeyId',
11 secretAccessKey: 'secretAccessKey',
12 url : 's3.eu-west-3.amazonaws.com',
13 region : 'eu-west-3'
14 }])
15
16s3storage.downloadFile('bucketName', 'filename.pdf', (err, resp) => {
17 if (err) {
18 return console.log("Error on download: ", err);
19 }
20 /**
21 * Request reponse:
22 * - resp.body => downloaded file as Buffer
23 * - resp.headers
24 * - resp.statusCode
25 */
26})
Install
1$ npm install
To run all the tests:
1$ npm run test
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
No vulnerabilities found.
No security vulnerabilities found.