项目作者: feross

项目描述 :
Convert a Readable Stream to a Blob URL
高级语言: JavaScript
项目地址: git://github.com/feross/stream-to-blob-url.git
创建时间: 2015-12-29T20:42:49Z
项目社区:https://github.com/feross/stream-to-blob-url

开源协议:MIT License

下载


stream-to-blob-url travis npm downloads javascript style guide

Convert a Readable Stream to a Blob URL

Sauce Test Status

This package converts a Readable Stream into a Blob URL.

This package is used by WebTorrent.

install

  1. npm install stream-to-blob-url

usage

  1. const toBlobURL = require('stream-to-blob-url')
  2. const fs = require('fs')
  3. const blobUrl = await toBlobURL(fs.createReadStream('file.txt'))
  4. 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.