0.2.0 • Published 5 years ago

azure-fileshare-listener v0.2.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

File Share Helper

A library for interfacing with Azure File Share

  • listening to changes and make callbacks with identified changes
  • backing up files
  • downloading files

Motivation

By listening to Azure File Share changes it is possible to kick off processing pipelines as end users dump files into a file share.

How to setup

Gets dependencies

npm install

How to use

Listen

For each change identified the callback receives an entity of the following form

{
    name: <filename>,
    action: <one of create or update>
}
  • Define your callback to handle the change ...which is an entity with keys 'name' and 'action
  • Define your config which references Azure
  • Instantiate the listener with the config
  • Request to listen with changes delivered to your callback
let mycallback =(change)=>{
    let { name, action} = change
    ...handle change to file
}
let config = {
      POLL_FREQUENCY: 10000,
      account: <azure account>,
      accountKey: <azure access key>,
      shareName: <azure file name>,
      directoryName: <azure directory>
    }
let listener = Listener(config)
listener.listen(mycallback)

How to develop

npm start

This will lint the source, run the tests

How to view implementation debug

export DEBUG=listener,listener.test