Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 486 Bytes

combine-path-from-parts.md

File metadata and controls

16 lines (11 loc) · 486 Bytes

How to combine a path from parts with Node.js

Instead of joining or concatenating strings, you can use the nodejs path module and the join method:

import path from 'path';

function getOutputPath(dest: string, folderName: string, fileName: string): string {
    return path.join(dest, folderName, fileName);
}

getOutputPath('C:\\source', 'git', '.gitignore'); // C:\\source\\git\\.gitignore

References: