using file instead of fs