title: NodeJS: Data argument must be of type string/Buffer/TypedArray/DataView, how to fix?
body: <p>This Node JS code is from <a href="https://github.com/orderstack/hyperledger-fabric-v2-starter/blob/master/network/code/blockEventListener.js" rel="noreferrer">this project</a> which I'm trying to understand.</p>
  
  <pre><code>// initialize the next block to be 1
  let nextBlock = 1
  
  // check to see if there is a next block already defined
  if (fs.existsSync(configPath)) {
      // read file containing the next block to read
      nextBlock = fs.readFileSync(configPath, "utf8")
  } else {
      // store the next block as 0
      fs.writeFileSync(configPath, parseInt(nextBlock, 10))
  }
  </code></pre>
  
  <p>I get this error message:</p>
  
  <pre><code>Failed to evaluate transaction: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1)
  </code></pre>
  
  <p>I'm not too familiar with NodeJS, so could anyone explain to me how I can change this code to remove the error?</p>