A
A
Artem Shchurin2017-03-16 13:42:06
JavaScript
Artem Shchurin, 2017-03-16 13:42:06

How to form a relative path to a file in NodeJS?

Good afternoon I
use var path = require('path')
To modify file paths
I want to get a cross-platform path, of this format
'./app/module/......'
But using all possible options for adding paths, I get
'app/module/......'
And this slash is very important at the beginning

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2017-03-16
@AppFA

Perhaps something like this:

path.format({
    root: './',
    name: 'app/module/'
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question