0.0.2 • Published 7 years ago
move-dir v0.0.2
MoveDir
A recursive directory mover built with rxjs with support for promises.
Installation
yarn add move-diror
npm i --save move-dirExample
Assuming you have a directory called input with the following structure
input
├── level 1
| ├── level 2
| | └── file
| ├── level 2
| | └── level 3
└── fileIf you want to move this a brand new COOL directory, moveDir will create the COOL directory with the following structure
COOL
├──input(level 1)
| ├── level 2
| ├── level 3
| | └── file
| ├── level 3
| └── level 4
| └── fileUsage
Rxjs
This library will by default return an observable stream. The most basic usage is as follows
import moveDir from 'move-dir';
moveDir(inputDirectory:string, outputDirectory:string).subscribe();
//Will copy the inputDirectory into the outputDirectoryPromises
This library is also compatible with promises.
basic promise
import moveDir from 'move-dir';
moveDir(inputDirectory:string,outputDirectory:string, { asPromise: true })
.then()
.catch()
//Will copy the inputDirectory into the outputDirectoryasync/await
import moveDir from 'move-dir';
await moveDir(inputDirectory:string,outputDirectory:string, { asPromise: true })
//Will copy the inputDirectory into the outputDirectory