New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fh-wfm-file

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fh-wfm-file

A WFM module providing client and backend for file support

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

FeedHenry RainCatcher file Build Status

A module for FeedHenry RainCatcher that manages files. It provides :

  • Backend services that expose REST endpoints to create and read operations for files .
  • Services providing a REST client for files.

See raincatcher-file-angular module for angular client side implementation

Client-side usage

This module is packaged in a CommonJS format, exporting the name of the Angular namespace. The module can be included in an angular.js as follows:

var fileCore = require('fh-wfm-file/lib/client');
fileCore(mediator,{},$fh);

Topic Subscriptions

wfm:files:create
Description

Creating a new File

Example
var parameters = {
  fileToCreate: {
    //A Valid JSON Object
  },
  //Optional topic unique identifier.
  topicUid: "uniquetopicid"
}

mediator.publish("wfm:files:create", parameters);
wfm:files:list
Description

List All files

Example
var parameters = {
  userId : "userId"
  //Optional topic unique identifier.
  topicUid: "uniquetopicid"
}

mediator.publish("wfm:files:list", parameters);

Usage in an express backend

The server-side component of this WFM module exports a function that takes express and mediator instances as parameters, as in:

var express = require('express')
  , app = express()
  , mbaasExpress = mbaasApi.mbaasExpress()
  , mediator = require('fh-wfm-mediator/lib/mediator')
  ;

// configure the express app
...

// setup the wfm user router
require('fh-wfm-file/lib/cloud')(mediator, app);

Exposed endpoints

Base url : /file/wfm

resourcemethodreturns
/allGETarray of files
/owner/:ownerGETfiltered array of files
/owner/:owner/upload/base64/:filenamePOSTfile metadata
/upload/binaryPOSTfile metadata
File metadata structure
   {
      owner: req.params.owner,
      name: req.params.filename,
      uid: uuid.create().toString()
   }

Supported storage engines

By default file module would store files in filesystem temporary folder.

AWS S3 storage

Allows to store files in AWS S3 buckets.

Options:

var storageConfig = {
  s3: {
    s3Options: {
      accessKeyId: process.env.AWS_S3_ACCESS_KEY,
      secretAccessKey: process.env.AWS_S3_ACCESS_KEY_SECRET,
      region: process.env.AWS_S3_REGION
    },
    bucket: "raincatcher-files"
  }
}
require('fh-wfm-file/lib/cloud')(mediator, storageConfig);

Gridfs MongoDB storage

Allows to store file in MongoDB database using Gridfs driver

Options:

var storageConfig = {
  gridFs: {
    mongoUrl: "mongodb://localhost:27017/files"
  }
};
require('fh-wfm-file/lib/cloud')(mediator, storageConfig);

Keywords

FAQs

Package last updated on 27 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc