Skip to content

sivsivsree/fs-js-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fs-js-client

N|lrucache-nodejs

File Service fs-js-client is a nodejs client for FileService Service. This is the library to consume your Fileservice server services. The server and detailed info you can find in github. N|lrucache-nodejs

About

fs-js-client uses a number of open source projects to work properly:

  • [fs-extra] - File System on Sterioid!
  • [amqplib] - RabbitMQ client service.

Installation

Install the dependencies and start the server.

$ npm install fs-js-client --save

Usage

var client = require('fs-js-client').FileService;

const CREDENTIALS = {
    API_KEY: <KEY_GENERATED_FROM_CUSTOM_SERVER>,
    USER: <rabbitmq user>,
    PASS: <rabbitmq client>,
    HOST: <rabbitmq host, example- 192.168.1.153>,
    PORT: <PORT ex: 5672>
};

let service = new client(CREDENTIALS).setBucket("<BUCKET NAME>");

service.uploadFile(<path to file>).then((data) => {
    console.log(data);
});

//upload another file 
service.uploadFile("anotherfile.jpg").then((data) => {
    console.log(data);
});

//upload another file with diffrent bucket
service.setBucket("<NEW BUCKET>").uploadFile("anotherfile.jpg").then((data) => {
    console.log(data); //data.file will give you the file key in server which is used to reference the file.
});

//after upload you will get, 
//http://yourserverip/file/<YOUR BUCKET>/<FILENAME>
//will give you the file.
{
    bucket:<BUCKET NAME>,
    filename:<FILENAME>
}

N|lrucache-nodejs

About

Fileservice Javascript Client.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published