0.0.1 • Published 3 years ago

@shieldsbetter/slurp-uri v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

slurp-uri

Reads the contents of a URI into a Buffer or string.

(Because I got tired of gluing get-uri to stream-to-array).

Usage

const slurpUri = require('@shieldsbetter/slurp-uri');

async function main() {
    console.log(await slurpUri('data:,hello world'), { encoding: 'utf8' });
}

Options

A second parameter may be passed containing options. Supported options:

  • encoding - (Optional) If specified, the URI's bytes will be decoded and returned as a string with the specified encoding. If omitted, the raw Buffer will be returned.
  • getUriOptions - (Optional - default {}) Passed verbatim to get-uri.