file-url 0 editorconfig travis-ci npm

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

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

curl

curl

A command line tool and library for transferring data with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TFTP, SCP, SFTP, TELNET, DICT, LDAP, LDAPS, FILE, IMAP, SMTP, POP3, RTSP and RTMP. libcurl offers a myriad of powerful features ...

JavaScript-Load-Image

JavaScript-Load-Image

JavaScript Load Image is a library to load images provided as File or Blob objects or via URL. It returns an optionally scaled and/or cropped HTML img or canvas element. It also provides a method to parse image meta data to extract Exif tags and thumbnail ...

crayon-syntax-highlighter

crayon-syntax-highlighter

Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text. ...

BNHtmlPdfKit

BNHtmlPdfKit

Easily turn HTML data from an HTML string or URL into a PDF file on iOS ...

libfastcommon

libfastcommon

c common functions library extracted from my open source project FastDFS. this library is very simple and stable. functions including: string, logger, chain, hash, socket, ini file reader, base64 encode / decode, url encode / decode, fast timer, skiplist ...


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