[SOLVED] NodeJS Stream Pipeline – The "val" argument must be an instance of Readable, Iterable, or AsyncIterable. Received an instance of WriteStream

Issue File: index3.js #!/usr/bin/env node ‘use strict’; import { pipeline } from ‘stream/promises’ import { realpathSync, createReadStream, createWriteStream } from ‘fs’; import { pathToFileURL } from ‘url’; async function doStuff() { return new Promise((resolve, reject) => { let readStream =

Continue reading

[SOLVED] node.js: send the output of stdout as response

Issue const express = require(‘express’); const { stdout } = require(‘process’); const router = express.Router(); router.get(‘/’, (req, resp) => { var exec = require(‘child_process’).exec; exec( ‘npx hardhat run scripts/deploy-contract.mjs –network PolygonMumbai’, function (error, stdout, stderr) { console.log(‘stdout: ‘ + stdout);

Continue reading