Txt file js
r3b0rn (28)

How do you edit text files using js not node js but js

You are viewing a single comment. View All
Answered by EpicGamer007 (1752) [earned 5 cycles]
View Answer
SixBeeps (5321)

To further elaborate on what @EpicGamer007 said:

If browser JS had access to the local file system, that would mean anyone could make a website to simply delete all of your files in one go, all without user input. Not good.

Instead, if you were to use Node.js, that works in the application scope rather than in the internet scope. Thus, there'd be no danger in allowing access to the local file system.

What exactly are you looking to achieve by editing a file on the local system?

r3b0rn (28)

@SixBeeps i was gonna use it to save stuff from my game, idk how to do anything like thtat

r3b0rn (28)

@SixBeeps In other words, scores of people to make a leaderboard!

SixBeeps (5321)

@r3b0rn Read into localStorage, which allows access to a very limited portion of the file system. It doesn't let you use a full .txt file, but instead it acts as a dictionary specific to your game that you can change.

EpicGamer007 (1752)

@r3b0rn if you want to make a leaderboard, you need a database on the server (unless you want to leaderboard to be local only)

r3b0rn (28)

@SixBeeps is there a way to get someones repl username in js?