Answers for "require("path")"

1

what is require('path')

The path module provides utilities for working with file and directory paths.
It can be accessed using:
const path = require('path');

on POSIX;
path.basename('C:\temp\myfile.html');
// Returns: 'C:\temp\myfile.html'


On Windows:
path.basename('C:\temp\myfile.html');
// Returns: 'myfile.html'
Posted by: Guest on April-18-2021
1

node.js name of file

var path = require('path');
var scriptName = path.basename(__filename);
Posted by: Guest on November-10-2020

Code answers related to "require("path")"

Browse Popular Code Answers by Language