file-url 0 editorconfig travis-ci npm

Convert a path to a file url: unicorn.jpg ➔ file:///Users/sindresorhus/unicorn.jpg

3 years after MIT

file-url Build Status

Convert a path to a file url: unicorn.jpgfile:///Users/sindresorhus/unicorn.jpg

Install

$ npm install --save file-url

Usage

const fileUrl = require('file-url');

fileUrl('unicorn.jpg');
//=> 'file:///Users/sindresorhus/dev/file-url/unicorn.jpg'

fileUrl('/Users/pony/pics/unicorn.jpg');
//=> 'file:///Users/pony/pics/unicorn.jpg'

// passing {resolve: false} will make it not call path.resolve() on the path
fileUrl('unicorn.jpg', {resolve: false});
//=> 'file:///unicorn.jpg'

CLI

$ npm install --global file-url
$ file-url --help

  Usage
    $ file-url [path]

  Example
    $ file-url
    file:///Users/sindresorhus/dev/file-url

License

MIT © Sindre Sorhus

Related Repositories

Meteor-CollectionFS

Meteor-CollectionFS

Reactive file manager for Meteor ...

cordova-plugin-file

cordova-plugin-file

Mirror of Apache Cordova Plugin file ...

cordova-plugin-file-transfer

cordova-plugin-file-transfer

Mirror of Apache Cordova Plugin file-transfer ...

go-getter

go-getter

Package for downloading things from a string URL using a variety of protocols. ...

yii2-file-upload-widget

yii2-file-upload-widget

BlueImp File Upload Widget for Yii2 ...


Top Contributors

sindresorhus arthurvr felixfbecker

Dependencies

package version
dev ava *
xo *

Releases

-   v1.1.0 zip tar
-   v1.0.0 zip tar
-   v0.1.0 zip tar
-   1.0.1 zip tar