1.2.0 • Published 2 years ago

simple-file-creator v1.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

simple-file-creator

A library for creating file structures through simple node operations.

npm install simple-file-creator
  • new SimpleFileCreator(path, cover)

    • path <String> Create a folder as the root node.
    • cover <String> Overwrite existing folder
  • instance.pushFolder(folderName)

    • folderName <String> Create the name of the folder
  • instance.pushFile(fileName, content)

    • fileName <String> Create file name (eg.ts)
    • content <String> File content

Example

import SimpleFileCreator from 'simple-file-creator'
import { resolve } from 'node:path'
 
const fsn = new SimpleFileCreator(resolve(__dirname, 'folder'), defaultConfig) 
//folder

const sub = fsn.pushFolder('sub')
//folder
//   └─sub

const ts = sub.pushFile('hellow.ts', `console.log('${'hellow'}')`)
              .pushFile('world.ts', `console.log('${'world'}')`)
//testFolder
//   └─sub
//      └─hellow.ts
//      └─world.ts

ts.delete()
//folder
//   └─sub
//      └─hellow.ts

sub.delete()
//folder

License

MIT License © 2024-PRESENT muamuamu

1.2.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago