seek() equivalent in javascript/node.js?

后端 未结 2 927
暗喜
暗喜 2020-12-19 00:52

I m currently trying to read some files with fs module for node.js. Since it lack a tot of the function I m used to (fseek(), getline()...), I m creating another module to g

2条回答
  •  难免孤独
    2020-12-19 01:00

    In node.js the seek functionality is included in the read function. When you use the fs.read function, there is a parameter called position, that works as the seek position.

    If what you want is to write to the file, the function fs.write also has the position parameter.

    Check the docs here: https://nodejs.org/api/fs.html#fs_fs_read_fd_buffer_offset_length_position_callback

提交回复
热议问题