@shieldsbetter/slurp-uri
v0.0.1
Published
Read contents of a URI into a buffer or string.
Downloads
1
Readme
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 toget-uri
.