Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/feross/stream-to-blob-url
Convert a Readable Stream to a Blob URL
https://github.com/feross/stream-to-blob-url
blob blob-url javascript nodejs stream
Last synced: about 2 months ago
JSON representation
Convert a Readable Stream to a Blob URL
- Host: GitHub
- URL: https://github.com/feross/stream-to-blob-url
- Owner: feross
- License: mit
- Created: 2015-12-29T20:42:49.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-05-25T04:23:23.000Z (over 4 years ago)
- Last Synced: 2024-10-17T17:24:06.751Z (3 months ago)
- Topics: blob, blob-url, javascript, nodejs, stream
- Language: JavaScript
- Homepage:
- Size: 30.3 KB
- Stars: 25
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stream-to-blob-url [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
[travis-image]: https://img.shields.io/travis/feross/stream-to-blob-url/master.svg
[travis-url]: https://travis-ci.org/feross/stream-to-blob-url
[npm-image]: https://img.shields.io/npm/v/stream-to-blob-url.svg
[npm-url]: https://npmjs.org/package/stream-to-blob-url
[downloads-image]: https://img.shields.io/npm/dm/stream-to-blob-url.svg
[downloads-url]: https://npmjs.org/package/stream-to-blob-url
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com#### Convert a Readable Stream to a Blob URL
[![Sauce Test Status](https://saucelabs.com/browser-matrix/stream-to-blob-url.svg)](https://saucelabs.com/u/stream-to-blob-url)
This package converts a Readable Stream into a Blob URL.
This package is used by [WebTorrent](https://webtorrent.io).
## install
```
npm install stream-to-blob-url
```## usage
```js
const toBlobURL = require('stream-to-blob-url')
const fs = require('fs')const blobUrl = await toBlobURL(fs.createReadStream('file.txt'))
console.log(url)
```## api
### promise = toBlobURL(stream, [mimeType], callback)
Convert the Readable `stream` into a W3C `Blob` URL (`blob:...`), optionally,
with the given `mimeType`.Returns a `Promise` which resolves to a `string` on success. Otherwise, rejects
with an `Error`.## license
MIT. Copyright (c) [Feross Aboukhadijeh](https://feross.org).