ocbesbn-blob-client
This module provides simple and easy server side access to the blob storage service. For further details of how to use this module, please have a look at the wiki of this module and the blob service wiki.
Minimum setup
First got to your local code directory and run:
npm install ocbesbn-blob-client
In order to run BlobClient, you'll need a setup consisting of a running blob service and a working consul service registry with the blob service being registered under the name blob.
Since version 2.0, ocbesbn-blob-client defines multiple classes depending on which part of blob service one wants to access. Currently there are multiple classes which directly inherit BlobClient and therefor are interface compatible.
- BlobClient
- TempFileClient
- DataFileClient
const { BlobClient, TempFileClient, DataFileClient } = require('ocbesbn-blob-client'); const blobClient = new BlobClient();blobClient.getFileInfo('c_tenant', '/public/myFile.ext').then(info => console.log(info)).catch(err => console.log(err)); const tempFileClient = new TempFileClient();tempFileClient.getFileInfo('c_tenant', '/public/myFile.ext').then(info => console.log(info)).catch(err => console.log(err)); const dataFileClient = new DataFileClient();dataFileClient.getFileInfo('c_tenant', '/public/myFile.ext').then(info => console.log(info)).catch(err => console.log(err));
If an error occurs (HTTP status code >= 400), a result promise gets rejected as defined by the rules of ServiceClient.
Default configuration
The default configuration object provides hints about what the module's standard behavior is like and which configuration options are available. For further details about the API, please have a look at the wiki.
{ consul : { host : 'consul' }, serviceClient : null, forceServiceToken : false, clientType : 'files'}