part one:
I have a text.txt file in linux ubuntu.
I want to watch the file with tail for grabbing the last content of the file.
# command linux
tail -f text.txt
this command returns all of the content.
so I changed it to :
# command linux
tail -f -n 1 text.txt
but the same result again.
I examine the line of file with :
# command linux
wc -l text.txt
when content is appended to file, the line number counts changes.
so first of all what's wrong?
second, question is about nodejs
nodejs:
I want to run child_process(spawn):
let tailing_my_file = spawn("tail -f ./text.txt") // in root directory of project
is there any better idea for watching file content? and off the record, the file is getting huge. is it wise to use spawn for such heavy loads?