als-move

0.1.1 • Public • Published

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)

/als-move/

    Package Sidebar

    Install

    npm i als-move

    Weekly Downloads

    0

    Version

    0.1.1

    License

    ISC

    Unpacked Size

    2.46 kB

    Total Files

    3

    Last publish

    Collaborators

    • alexsorkin