Skip to content

Commit 6fca45e

Browse files
committed
readme
1 parent f735206 commit 6fca45e

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,20 @@ npm install stream-to-blob
2525
## usage
2626

2727
```js
28-
var toBlob = require('stream-to-blob')
29-
30-
toBlob(fs.createReadStream('file.txt'))
31-
.then(function(blob) {
32-
console.log(blob)
33-
})
34-
.catch(function(err) {
35-
console.error(err)
36-
})
28+
const streamToBlob = require('stream-to-blob')
29+
30+
const stream = fs.createReadStream('file.txt')
31+
const blob = await streamToBlob(stream)
3732
```
3833

3934
## api
4035

41-
### toBlob(stream, [mimeType])
36+
### promise = streamToBlob(stream, [mimeType])
37+
38+
Convert the given readable stream, `stream`, into a W3C `Blob`. If `mimeType` is provided, then the `Blob` will have its mime type set to that value.
4239

43-
Convert the Readable `stream` into a W3C `Blob`, optionally, with the given `mimeType`.
44-
It returns a `Promise` with `Blob` object on success or throws `Error` if failed.
40+
Returns a `Promise` which resolves to a `Blob` object on success. Otherwise, rejects with an `Error`.
4541

4642
## license
4743

48-
MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).
44+
MIT. Copyright (c) [Feross Aboukhadijeh](https://feross.org).

0 commit comments

Comments
 (0)