Skip to content

Error: Stream.pipe is not a function #2469

Open
@divyselva

Description

@divyselva

I tried to follow along with the example provided but when i run this code i get an error, stream.pipe is not a function. Im new to pg and nodeJS so Im not exactly sure where/how to fix this issue. This is the code i've been trying to run. Side note: Will running pg-query-stream allow me to use the results from the query in other js functions? Thanks, any help/advice is much appreciated.

const {Pool} = require('pg')

const QueryStream = require('pg-query-stream')
const JSONStream = require('JSONStream')

const pool = new Pool({})


const q = 'SELECT * FROM public."HexLogRecord"'

pool.connect()

var stream = pool.query(new QueryStream(q))

stream.pipe(JSONStream.stringify()).pipe(process.stdout)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions