escape-path-with-spaces
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

escape-path-with-spaces

Escape if needed spaces contained in a string file path

Install

$ npm install --save escape-path-with-spaces

Usage

const escape = require('escape-path-with-spaces');
// some paths
const aWindowsPath = "D:\\DDL\\ANIME\\les chevaliers du zodiaques\\whateverFile.avi";
const aPosixPath = "D:/DDL/ANIME/les chevaliers du zodiaques/whateverFile.avi";

// on Linux or Mac OS X
// gives "D:/DDL/ANIME/les\ chevaliers\ du\ zodiaques/whateverFile.avi"

// on Windows
console.log(escape(aWindowsPath));

// on recent builds ( >= Windows 10 1803)
// give the same path as recent builds handle spaces in path(s) 

// on old builds ( < Windows 10 1803)
// gives "D:\\DDL\\ANIME\\les%20chevaliers%20du%20zodiaques\\whateverFile.avi"

API

escape-path-with-spaces(filePath)

Escape if needed spaces contained in a string file path

License

MIT

Package Sidebar

Install

npm i escape-path-with-spaces

Weekly Downloads

164

Version

1.0.2

License

MIT

Unpacked Size

12.8 kB

Total Files

10

Last publish

Collaborators

  • jy95