nodejs synchronization read large file line by line?

后端 未结 5 1140
没有蜡笔的小新
没有蜡笔的小新 2021-01-02 07:54

I have a large file (utf8). I know fs.createReadStream can create stream to read a large file, but not synchronized. So i try to use fs.readSync, b

5条回答
  •  情深已故
    2021-01-02 08:26

    two potential problems,

    1. 3bytes BOM at the beginning you did not skip
    2. first 4bytes cannot be well format to UTF8's chars( utf8 is not fixed length )

提交回复
热议问题