npm add --save sql-modules
yarn add sql-modules
Given the following file structure:
files/
fileA.txt
fileB.txt
fileC.txt
files/fileA.txt
# requires fileB
File A
files/fileB.txt
# requires fileC
File B
files/fileC.txt
File C
Point topoFiles
at the files
directory.
const path = require('path')
const {topoFiles} = require('topo-files')
const filesDir = path.join(__dirname, 'files')
const combined = topoFiles(filesDir, {
ext: '.txt',
comment: '#'
})
console.log(combined)
Outputs:
# File: fileC.txt
File C
# File: fileA.txt
# requires fileC
File B
# File: fileB.txt
# requires fileB
File A