fileServer

Creates the simple file server for downloads and adds in the Slack events listener to the server

Source:
Parameters:
Name Type Description
slackEvents SlackEventAdapter

The event adapter for Slack from require("@slack/events-api").createEventAdapter

Methods

(inner) getRequestedPath(fileName, req, res) → {string|boolean}

Source:

Takes in the file path and request data and resolves it to a file path in the downloads folder
May be disabled with environment variables

Parameters:
Name Type Description
fileName string

Name of the file. Originates from req.url so it must start with a /

req IncomingMessage

Request object from http or any other server request

res ServerResponse

Response object from http or any other server request

Returns:

Returns the absolute path to a file in the downloads folder or false if access should be denied

Type
string | boolean

(inner) showFileList(filePath, res)

Source:

Lists the names of all files in the downloads folder. Can be disabled with environment variables.

Parameters:
Name Type Description
filePath string

Absolute path to a file in the downloads folder. May be a file that does not exist

res ServerResponse

Response object from http or any other server request