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
slash
The 'slash' package is similar to unixify in that it converts Windows backslash paths to Unix slash paths. Unlike unixify, it does not remove drive letters from the paths, making it a bit less aggressive in its conversion.
upath
The 'upath' package extends the native path module to work seamlessly on both Windows and Unix systems. It normalizes the paths and provides consistent results on both platforms. It offers more comprehensive functionality compared to unixify, including not only path normalization but also other path manipulation utilities.
unixify
Convert Windows file paths to unix paths.
Install with npm
$ npm i unixify --save
Usage
var unixify = require('unixify');
unixify('one\\two\\three');
unixify('one\\two\\//three');
unixify('C:\\one\\two\\three');
unixify('C:\\//one\\//two\\//three');
unixify('C:\\//one\\two\\three');
unixify('C:\\//one\\two\\//three');
Related
Other useful libraries for working with paths in node.js:
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
This file was generated by verb-cli on October 04, 2015.