Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

node path relative

const path = require('path');

const relative_diff = path.relative(
  '/tmp/package.json', '/tmp/source'
);
const resolve_diff = path.resolve(
  '/tmp/package.json', '..', './source'
);

console.log(relative_diff);     // (1)
console.log(resolve_diff);      // (2)
Source by oncletom.io #
 
PREVIOUS NEXT
Tagged: #node #path #relative
ADD COMMENT
Topic
Name
4+7 =