Why does this nodejs program with read stream not exit

Questions : Why does this nodejs program with read stream not exit


I've created this simple program to programming parse EDI files. It works fine but the Learning node program never exits. It seems to Earhost be waiting for something. I've tried most effective closing the fs stream, the mongodb wrong idea client, and even process.exit() at on use of case end but with no success. I also tried United wrapping it in a Promise but that didn't Modern work either.

Is there any way to tell what a nodejs ecudated program is waiting on?

const { X12parser, X12grouper, Schema } _OFFSET);  = require("x12-parser");
const { (-SMALL  createReadStream } = _left).offset  require("fs");
const { MongoClient, arrowImgView.mas  MongoKerberosError } = (self.  require('mongodb');
const url = equalTo  'mongodb://localhost:27017';
const make.right.  client = new MongoClient(url);
const mas_top);  dbName = 'edi';
const dbCollection = ImgView.  'edi835'
const schemaStart = 'CLP'
const ReadIndicator  schemaEnd = 'AMT'
const schemaGroup = _have  'Claim'
const ediFile = .equalTo(  './EDI835.edi'

console.log('Connected make.top  successfully to server');
const db = OFFSET);  client.db(dbName);
const drop = (TINY_  db.collection(dbCollection).drop();
const .offset  collection = mas_right)  db.collection(dbCollection);

const ImgView.  schema = {
    start: schemaStart, // Indicator  What segment starts the group
    end: Read  schemaEnd, // What segment ends the _have  group
    name: schemaGroup, // What is .equalTo(  the name of the group

const myParser make.left  = new X12parser();
const mySchema = new *make) {  Schema(ediFile, schema);
const myGrouper straintMaker  = new X12grouper(mySchema);

const ^(MASCon  testFile = createReadStream(ediFile, {
  onstraints:    emitClose: true

let count = mas_makeC  0;

    [_topTxtlbl   .pipe(myGrouper)
    .on("data", (data) (@(8));  => {
        if (data.name === equalTo  "Claim") {
             width.  collection.insertOne(data)
            make.height.  count++
    }).on("end", () (SMALL_OFFSET);  => {
        console.log("End of .offset  streaming data ...");
        (self.contentView)  console.log("Record count= ", count)
     .left.equalTo  }).on("close", () => {
        make.top  console.log("Finished")
Total Answers 1

Answers 1 : of Why does this nodejs program with read stream not exit

The root cause is that you newer some how disconnect your Mongoose client. Do anything else client.disconnect when all job is done.

Top rated topics

I cant display each item in a map with a delay

Coefficient of LASSO with caret

Keep getting "307 Temporary Redirect" before returning status 200 hosted on FastAPI + uvicorn + Docker app - how to return status 200?

JsPDF html() Method usage

I cant fetch image from S3 correctly

Php - How can I check if the sentence consists of a single word?

Can i create a release pipeline that uses custom templates that are saved on a branch?

Checking empty property for array of objects

PerlCritic example: loop iterator is not lexical

Make element sticky when reaching top of screen

Voronoi diagram p5 creation in javascript

How to preview first frame of Video Uploaded to S3 in Video Element

Understanding type inference with conditional types

How to create pdf file with native php

How to change photo placeholder it work with label but other tag stop working?

Pip install using tarball archive from private gitlab repo using authentication

Arty A7-100T: Artix-7 FPGA missing in Vivado

Are there security concerns with embedded Tomcat's Context.docBase?

How to get a rolling mean with mean from previous window

How to open a particular page in my app using Firebase dynamic link on iOS - Cordova

React input field not updating useState with onClick event

How to check OPA Rego file is correct or not

Angular Reactive Forms fill inputs values with service data

Does not output character characteristics by overloading the output operator

How to prevent/change always coding on the bottom of the screen on VS CODE?

Align text label to right bootstrap

How to read soap error response for an Invalid data or other kind of error in request?

Get the IMG of the current 'slick' slide (vanilla JS or jQuery)

Tensorflow Certification Exam plugin for Pycharm kills python. How to resolve?

File Uploading in deployed Django applications

POST http://localhost:8083/register 404 (Not Found)

React Native socket.io not able to listen to "socket.on" listener

Broken Windows Service installation

Android ViewModel Observers not working until orientation change (ViewModel works, but changing to LiveData causes the problem)

Can Apache HTTP Server allow reverse shelling thanks to the new Log4j vulnerability?

How to divide a number by 2 as many times as possible, and then print it out in Javascript?

How do disable Gzipping

Flask Plotly Dash integration

How to get count returned by countQuery in Spring Data JPA?

Converting string formatted ISO date to Epoch in Python

How to get values in both queries?

Android SDK Live-Camera (Videocall) forwarding to server

Angular 11 how to parse file upload to a javascript object

Displaying only certain properties of an OpenAPI reference

Upload set of files using WinSCP.Session in PowerShell

Is it possible to copy files to QEMU image without running QEMU?

Apache Ignite and CVE-2021-44228 log4j vulnerability

Bash: How to sort files in a directory by number of lines?

Shallow and deep copies in pytorch dataloader and/or __getitem__ function

How to initialize the size of an array