Base Directory Path Converter
This package converts file paths to starting from a desired "base" directory.
If the sourcePath is
and the provided filePath is
then the returned filepath will be
npm install --save base-path-converter
sourcePath- The path for the original "base" directory being read from
filePath- A filepath that for a file that was read from that source directory
A trimmed version of the filepath that starts from the "base" directory
Here's an example of the package being utilized to prepare a form-data object to be send to an API.
In this example, we want to overwrite the filepath we're sending for each file, as we don't want the API receiving the file to care about the "base" folder's parents.
const recursive = ;const FormData = ;const basePathConverter = ;const src = './../builds/React-Builds/myBuild/'recursive;