1.0.0 • Published 7 years ago

unixify v1.0.0

Weekly downloads
1,374,553
License
MIT
Repository
github
Last release
7 years ago

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.

@graphql-tools/graphql-file-loader@graphql-tools/json-file-loader@edgio/core@graphql-codegen/java-common@layer0/core@elnk/core-helpers@elnk/core-configs@prodam/prodam-typesnetlify-cli@everything-registry/sub-chunk-3015heapwolf-hyperdrivehypervaultgulp-gcloud-publish-win-supportgraphql-codegen-sbox-csharpjolt-frameworkkappa-drivelevel-vinyllibsass-asmemscripten-wasm-loaderesbuild-plugin-globes6-platofluent-vue-cligastropodeasy-replace-in-filesdwebfsjsplatoncatmountable-dwebtriemountable-dwtriemountable-hypertrienex-c-sharpmulti-semantic-releasepacktorplato-analyze@you54f/pact-cli@you54f/pact-core@you54f/pact-nodeprebuildify-crossddrivesystem-register-nameplutreskriptrsync2slice2tssatiresassdoc-theme-hermansassdoc-theme-pixuts-platotmpgendocker-share@torchlabs/netlify-cli@semantic-release-monorepo/corewebql-codegen-c-sharpaccess-sniffaccess-sniff-extabsolute-glob@netlify/zip-it-and-ship-it@netlify/create-sdk@prismify/ko@ponticus/ponticus@reskript/config-jest@reskript/config-webpack@reskript/core@reskript/cli-rollup@liquiad/graphql-codegen-sbox-csharp@liquiad/sbox-graphql-codegenwechatapp-pluginwebql-tools-loadwebql-tools-load-fileswebql-codegen-java-common@pact-foundation/pact-core@pact-foundation/pact-node@nasa_science/pact-nodeapp-g-screenshots@worldofgeese/core@wingsheep/fluent-vue-cli@certacrypt/certacrypt@web4/bitdrive@web4/mountable-bittrie@asiz33/smartblok-vendure-plugin@aschmidt8/netlify-cli@comate/plugin-host@bhvr/pact-nodeara-filesystem@cdn-publishing/graphql-codegen-c-sharp@abtnode/cli@flemist/ncattypescript-exportsupjs-platovile-statvile-syntvilevile-escomplexunion-hyperdrive@fraym/migrations@fomantic/rework-importwatchboy@garden-io/core@dikamilo/multi-semantic-release@design-token/inspector-loaders
1.0.0

7 years ago

0.2.1

9 years ago

0.1.0

9 years ago