1.1.0 • Published 10 months ago

folderst-maker v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

folderst-maker

Summary

Easy for create multilevel folders and files structures.

import { structure, file } from 'folderst-maker'

structure({
  folder1: {
    'inner-folder': {
      'hello.txt': file('Hello')
    }
  },
  folder2: {
    'some-object.json': file({ foo: 'bar' }),
    'some-array.json': file([1, 2, 3])
  }
}, 'path/to/root_dir')

API

structure

Args

  • folders: Folder - object base folder of your folders structure
  • root (Optianal): string - path where structure must create, default value is process.cwd()

Return void

structure(folders, root)

file

Args

  • content (Optianal): FileContent - thats will write in file, default value is empty string

Return new File

file(content)

Folder Object

Simple JavaScript object where keys must be strings and values another Folder or File.

const folders = {
  folder: {
    another_folder: {
      'file.txt': file()
    }
  },
  'example folder': {}
}

File Class

This class has just one property - contnet: FileContnet. You can init new object of this class by file function.

file('some content')

FileContent

May be a string, Object or Array. While file creating given object or array are transform to text format.

1.1.0

10 months ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago