file-operations
Functions
- deleteDocsFolder(docsFolder, rmPattern) ⇒
Promise.<Array.<string>>
Deletes the specified documentation folder and any additional paths matching the provided patterns.
- writeContentToFile(parseData, dest) ⇒
Promise.<(object|null)>
Writes the parsed content to a file on disk.
deleteDocsFolder(docsFolder, rmPattern) ⇒ Promise.<Array.<string>>
Deletes the specified documentation folder and any additional paths matching the provided patterns.
Kind: global function
Returns: Promise.<Array.<string>>
- A promise that resolves with an array of paths that were deleted.
Throws:
- Will throw an error if not all paths were successfully deleted.
Param | Type | Description |
---|---|---|
docsFolder | string | The path to the documentation folder to be deleted. |
rmPattern | Array.<string> | An array of glob patterns specifying additional paths to be deleted. |
Example
js
const docsFolder = './docs';
const rmPattern = ['**\/*.tmp']; // remove backslash
const deletedPaths = await deleteDocsFolder(docsFolder, rmPattern);
const docsFolder = './docs';
const rmPattern = ['**\/*.tmp']; // remove backslash
const deletedPaths = await deleteDocsFolder(docsFolder, rmPattern);
writeContentToFile(parseData, dest) ⇒ Promise.<(object|null)>
Writes the parsed content to a file on disk.
Kind: global function
Returns: Promise.<(object|null)>
- A promise that resolves with an object containing details of the saved file, or null if the operation fails. The returned object includes the original parsed data and a type indicating the status of the operation (e.g., included, excluded, error).
Throws:
- Will throw an error if there's an issue creating directories or writing to the file system.
Param | Type | Description |
---|---|---|
parseData | ParseReturn | undefined | The parsed data to be written to the file. |
dest | string | The destination path where the file should be written. |
Example
js
const parseData = {
content: '# My Documentation',
file: {name: 'example', ext: '.md'},
empty: false,
excluded: false
};
const dest = './docs';
const result = await writeContentToFile(parseData, dest);
const parseData = {
content: '# My Documentation',
file: {name: 'example', ext: '.md'},
empty: false,
excluded: false
};
const dest = './docs';
const result = await writeContentToFile(parseData, dest);