@strong-roots-capital/random-record-stream
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    random-record-stream Build status npm version codecov

    Create a Readable stream of random records

    Install

    npm install @strong-roots-capital/random-record-stream

    Use

    import randomRecordStream from '@strong-roots-capital/random-record-stream'
    import Record from 'timeseries-record'
    import moment from 'moment'
    
    let records: Record[] = []
    const sink = new Writable({
        objectMode: true,
        write(record: Record, _: any, callback: any) {
            records.push(record)
            callback()
        }
    })
    
    const start = moment.utc().startOf('year')
    const end = moment.utc().startOf('day')
    randomRecordStream(start.toDate(), end.toDate()).pipe(sink)
    
    sink.on('finish', () => {
        console.log('Records streamed:')
        console.log(records)
    })

    Related

    Install

    npm i @strong-roots-capital/random-record-stream

    DownloadsWeekly Downloads

    3

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    6.14 kB

    Total Files

    4

    Last publish

    Collaborators

    • amchelle
    • hamroctopus