Nobody Prefers Margarine
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    file-urlpublic

    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'

    Related

    License

    MIT © Sindre Sorhus

    install

    npm i file-url

    Downloadsweekly downloads

    26,740

    version

    2.0.2

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar