0.1.1 • Published 2 years ago

als-move v0.1.1

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

isExist

isExist

let {isExist} = require('als-move')
let {join} = require('path')
let dirPath = join(__dirname,'src')
let fileName = 'file.txt'
let newFileName = isExist(fileName,dirPath)
// if src/file.txt not exists, newFileName = fileName
// if src/file.txt exists, newFileName = 'file(1).txt'
// if src/file(1).txt exists, newFileName = 'file(2).txt'
// if src folder not exists, creates it

rename

let {rename} = require('als-move')
let {join} = require('path')

let srcFilePath = join(__dirname,'src',fileName)
let newFileName = 'newfile' // rename will add extension
rename(srcFilePath,newFileName)
// If such filename allready exists, add (i)

moveFile

let {moveFile} = require('als-move')

let {join} = require('path')
let srcFilePath = join(__dirname,'src',fileName)

let destDirPath = 'dest'
moveFile(srcFilePath,destDirPath)

// If filename from src has (i), remove it
// If file on destination exists, add to it (i)
0.1.1

2 years ago

0.1.0

2 years ago