Remove absolute paths

This commit is contained in:
CrazyMax
2020-04-08 00:33:20 +02:00
parent ff47e64685
commit fce5f2e313
342 changed files with 6646 additions and 7223 deletions
+16 -10
View File
@@ -6,7 +6,7 @@
## Install
```
$ npm install --save get-stream
$ npm install get-stream
```
@@ -15,10 +15,11 @@ $ npm install --save get-stream
```js
const fs = require('fs');
const getStream = require('get-stream');
const stream = fs.createReadStream('unicorn.txt');
getStream(stream).then(str => {
console.log(str);
(async () => {
const stream = fs.createReadStream('unicorn.txt');
console.log(await getStream(stream));
/*
,,))))))));,
__)))))))))))))),
@@ -40,7 +41,7 @@ getStream(stream).then(str => {
\~\
~~
*/
});
})();
```
@@ -54,6 +55,8 @@ Get the `stream` as a string.
#### options
Type: `Object`
##### encoding
Type: `string`<br>
@@ -66,7 +69,7 @@ Default: `utf8`
Type: `number`<br>
Default: `Infinity`
Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected.
Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `getStream.MaxBufferError` error.
### getStream.buffer(stream, [options])
@@ -92,11 +95,14 @@ It honors both the `maxBuffer` and `encoding` options. The behavior changes slig
If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error.
```js
getStream(streamThatErrorsAtTheEnd('unicorn'))
.catch(err => {
console.log(err.bufferedData);
(async () => {
try {
await getStream(streamThatErrorsAtTheEnd('unicorn'));
} catch (error) {
console.log(error.bufferedData);
//=> 'unicorn'
});
}
})()
```