Socket
Socket
Sign inDemoInstall

unixify

Package Overview
Dependencies
2
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    unixify

Convert Windows file paths to unix paths.


Version published
Weekly downloads
2.8M
decreased by-18.49%
Maintainers
2
Install size
22.2 kB
Created
Weekly downloads
 

Package description

What is unixify?

The unixify npm package is a utility that converts Windows-style file paths to Unix-style file paths. It is a simple and lightweight package that can be used to ensure file paths are compatible with Unix-based systems, which is particularly useful when working with tools or codebases that are expected to run across different operating systems.

What are unixify's main functionalities?

Convert Windows paths to Unix paths

This feature allows you to convert a Windows file path to a Unix file path by replacing backslashes with forward slashes and removing any drive letters.

const unixify = require('unixify');
const unixPath = unixify('C:\\Users\\Example\\file.txt');
console.log(unixPath); // Output: '/Users/Example/file.txt'

Other packages similar to unixify

Readme

Source

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

  • contains-path: Return true if a file path contains the given path. | homepage
  • ends-with: Returns true if the given string or array ends with suffix using strict equality for… more | homepage
  • is-absolute: Polyfill for node.js path.isAbolute. Returns true if a file path is absolute. | homepage
  • normalize-path: Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a… more | homepage
  • path-ends-with: Return true if a file path ends with the given string/suffix. | homepage

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.

Keywords

FAQs

Last updated on 15 Apr 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc