into-stream
Advanced tools
Comparing version 5.0.0 to 5.1.0
/// <reference types="node"/> | ||
import {Readable as ReadableStream} from 'stream'; | ||
export type Input = | ||
| Buffer | ||
| NodeJS.TypedArray | ||
| ArrayBuffer | ||
| string | ||
| Iterable<Buffer | string>; | ||
declare namespace intoStream { | ||
type Input = | ||
| Buffer | ||
| NodeJS.TypedArray | ||
| ArrayBuffer | ||
| string | ||
| Iterable<Buffer | string>; | ||
export type InputObject = | ||
| {[key: string]: unknown} | ||
| Iterable<{[key: string]: unknown}>; | ||
type InputObject = | ||
| {[key: string]: unknown} | ||
| Iterable<{[key: string]: unknown}>; | ||
} | ||
declare const intoStream: { | ||
/** | ||
* Convert `input` into a stream. Adheres to the requested chunk size, except for `array` where each element will be a chunk. | ||
* | ||
* @param input - The input to convert to a stream. | ||
* @returns A [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable). | ||
*/ | ||
(input: Input | Promise<Input>): ReadableStream; | ||
Convert `input` into a stream. Adheres to the requested chunk size, except for `array` where each element will be a chunk. | ||
@param input - The input to convert to a stream. | ||
@returns A [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable). | ||
@example | ||
``` | ||
import intoStream = require('into-stream'); | ||
intoStream('unicorn').pipe(process.stdout); | ||
//=> 'unicorn' | ||
``` | ||
*/ | ||
(input: intoStream.Input | Promise<intoStream.Input>): ReadableStream; | ||
/** | ||
* Convert object `input` into a stream. | ||
* | ||
* @param input - The object input to convert to a stream. | ||
* @returns A [readable object stream](https://nodejs.org/api/stream.html#stream_object_mode). | ||
*/ | ||
object(input: InputObject | Promise<InputObject>): ReadableStream; | ||
Convert object `input` into a stream. | ||
@param input - The object input to convert to a stream. | ||
@returns A [readable object stream](https://nodejs.org/api/stream.html#stream_object_mode). | ||
*/ | ||
object( | ||
input: intoStream.InputObject | Promise<intoStream.InputObject> | ||
): ReadableStream; | ||
// TODO: Remove this for the next major release | ||
default: typeof intoStream; | ||
}; | ||
export default intoStream; | ||
export = intoStream; |
@@ -65,2 +65,3 @@ 'use strict'; | ||
module.exports = intoStream; | ||
// TODO: Remove this for the next major release | ||
module.exports.default = intoStream; | ||
@@ -67,0 +68,0 @@ |
{ | ||
"name": "into-stream", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Convert a string/promise/array/iterable/buffer/typedarray/arraybuffer/object into a stream", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && ava && tsd-check" | ||
"test": "xo && ava && tsd" | ||
}, | ||
@@ -44,12 +44,12 @@ "files": [ | ||
"dependencies": { | ||
"from2": "^2.1.1", | ||
"from2": "^2.3.0", | ||
"p-is-promise": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.3.1", | ||
"ava": "^1.4.1", | ||
"get-stream": "^5.0.0", | ||
"p-event": "^3.0.0", | ||
"tsd-check": "^0.3.0", | ||
"p-event": "^4.1.0", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
6536
123
Updatedfrom2@^2.3.0