Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process exits on apple silicon #208

Open
3commascapital opened this issue Dec 4, 2021 · 0 comments
Open

process exits on apple silicon #208

3commascapital opened this issue Dec 4, 2021 · 0 comments

Comments

@3commascapital
Copy link

3commascapital commented Dec 4, 2021

  • Operating System: macOS Big Sur 11.6
  • Node Version: 14.17.6
  • NPM Version: 7.12.0 - 1.22.15 (yarn)
  • csv-parser Version: ^3.0.0

Expected Behavior

to parse the csv (tsv in this case)

Actual Behavior

exits process. seems like with code 0

How Do We Reproduce?

download a bitcoin utxo day of data from the bottom of this page: https://gz.blockchair.com/bitcoin/outputs/ and try to unzip it. i am mapping the keys to camel cased, and converting values to useful ones such as numbers, dates, etc (separator is "\t")

specifically, i am using neat-csv to parse,

import * as fs from 'fs'
import BigNumber from 'bignumber.js'

export interface BlockchairOutput {
  blockId: number;
  transactionHash: string;
  index: number;
  time: Date;
  value: BigNumber;
  valueUsd: BigNumber;
  recipient: string;
  type: string;
  scriptHex: string;
  isFromCoinbase: boolean;
  isSpendable: number;
}

  const file = fs.createReadStream(filepath)
    .pipe(
      zlib.createGunzip()
    )
  const data = await neatCsv<BlockchairOutput>(file as unknown as fs.ReadStream, {
    separator: '\t',
    mapHeaders: ({ header }) => _.camelCase(header),
    mapValues: ({ header, value }) => {
      switch(header) {
        case 'blockId':
          return +value
        case 'index':
          return +value
        case 'value':
          return new BigNumber(value)
        case 'time':
          return new Date(value + 'Z')
        case 'valueUsd':
          return new BigNumber(value)
        case 'isFromCoinbase':
          return +value === 1
        default:
          return value
      }
    }
  })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant