Convert promise to a pull-stream
npm install pull-from-promiseConvert a Promise into a pull stream source.
``
fromPromise(Promise
fromPromise(Promise
fromPromise(Promise(Array)
`
Call with true for the spread parameter and the promise will be expected
to resolve to an array and each item be pushed to the pull stream.
`js
var pull = require('pull-stream');
var formPromise = require('pull-from-promise');
pull(
fromPromise(Promise.resolve('something')),
pull.collect(function( err, array ){
console.log(array); // [ 'something' ]
})
);
`
`js
var pull = require('pull-stream');
var formPromise = require('pull-from-promise');
pull(
fromPromise(Promise.resolve([ 1, 2, 3 ]), true),
pull.collect(function( err, array ){
console.log(array); // [ 1, 2, 3 ]
})
);
``