strdir
v1.0.1
Published
Aggregates file contents in a directory into a string, with optional recursive walking and extension filtering
Maintainers
Readme
strdir
Canonical URL:
https://alexstevovich.com/a/strdir-nodejs
Software URL:
https://midnightcitylights.com/software/strdir-nodejs
Aggregates file contents in a directory into a string, with optional recursive walking and extension filtering.
Installation
npm install strdirExample
import strdir from 'strdir';
// ─── Async Usage ───
const content = await strdir('./directory', {
recursive: true,
extensions: ['.txt'],
});
console.log(content); // Output: All .txt file contents in the directory
// ─── Sync Usage ───
const syncContent = strdir.sync('./directory', {
recursive: true,
extensions: ['.md'],
});
console.log(syncContent); // Output: All .md file contents in the directoryLicense
Licensed under the MIT License.
