0.0.29 • Published 4 years ago

@solidgoldpig/fb-user-filestore-client-node v0.0.29

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Form Builder User File Store client (Node)

Client for making requests to Form Builder platform user filestore endpoints

Requirements

Node

Installation

npm install @solidgoldpig/fb-user-filestore-client-node

Usage

Loading and initialising

// load client
const FBUserFileStoreClient = require('@solidgoldpig/fb-user-filestore-client-node')

// initialise client
const userFileStoreClient = new FBUserFileStoreClient(serviceSecret, serviceToken, serviceSlug, userFileStoreUrl)

Fetching and storing

// fetch user file
userFile = await userFileStoreClient.fetch(userId, userToken, fingerprint)
// userFile => { file }

// store user file
policy = { [max_size], [expires], [allowed_types] }
uploadDetails = await userFileStoreClient.store(userId, userToken, file, policy)
// uploadDetails => { fingerpint, url, size, type, date }

// store user file from file path
uploadDetails = await userFileStoreClient.storeFromPath(userId, userToken, filePath, policy)