createfilex
v1.0.1
Published
A simple utility to create multiple files with a single function call. made with love by Abdullah.
Maintainers
Readme
createfilex
A simple utility to create multiple files with a single function call.
Installation
npm install createfilexUsage
const createfilex = require("createfilex");
// Create multiple files at once
createfilex("index.txt", "index.js", "index.css");
// Create files in subdirectories (directories will be created if they don't exist)
createfilex("src/components/Button.jsx", "styles/main.css");
// Check the results
const results = createfilex("config.json", "README.md");
console.log(results);
// Output: { 'config.json': 'created', 'README.md': 'already exists' }API
createfilex(...fileNames)
Creates multiple files based on the provided file names.
Parameters:
...fileNames: One or more strings representing file names with extensions.
Returns:
- An object containing the status of each file creation:
'created': The file was successfully created.'already exists': The file already exists and was not modified.'error: [message]': An error occurred while creating the file.
Features
- Create multiple files with a single function call
- Automatically creates directories for nested file paths
- Provides status feedback for each file creation
- Simple and straightforward API
License
MIT
