1. unixify
Convert Windows file paths to unix paths.
unixify
Package: unixify
Created by: jonschlinkert
Last modified: Tue, 28 Jun 2022 05:06:56 GMT
Version: 1.0.0
License: MIT
Downloads: 14,779,740
Repository: https://github.com/jonschlinkert/unixify

Install

npm install unixify
yarn add unixify

unixify NPM version NPM monthly downloads Linux Build Status

Convert Windows file paths to unix paths.

Install

Install with npm:

 $ npm install --save unixify

Install with yarn:

 $ yarn add unixify

Usage

 var unixify = require('unixify');
unixify(filepath[, stripTrailingSlash]);

Strips leading drive letters and dot-slash (./)

 unixify('.\\one\\two\\three');  //=> 'one/two/three'
unixify('./one/two/three');     //=> 'one/two/three'
unixify('C:\\one\\two\\three'); //=> '/one/two/three'
unixify('\\one\\two\\three');   //=> '/one/two/three'

Normalizes path separators to forward slashes

 unixify('one\\two\\three');      //=> 'one/two/three'
unixify('\\one\\two\\three');    //=> '/one/two/three'
unixify('C:\\one\\two\\three');  //=> '/one/two/three'

Combines multiple consecutive slashes

 unixify('one//two//////three'),     //=> 'one/two/three'
unixify('\\one\\two\\//three');     //=> '/one/two/three'
unixify('C:\\//one\\two\\//three'); //=> '/one/two/three'

Strips trailing slashes by default

 unixify('one//two//////three//'), //=> 'one/two/three'
unixify('C:\\one\\two\\three\\'); //=> '/one/two/three'

Keep trailing slashes

By passing false as the second argument

 unixify('one//two//////three//'), //=> 'one/two/three/'
unixify('C:\\one\\two\\three\\'); //=> '/one/two/three/'

About

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

 $ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

 $ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert.
Released under the MIT License.


This file was generated by verb-generate-readme, v0.5.0, on April 14, 2017.

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin