How to load file

Hi,
I got a question about how to load file through js.

Now I have save a file, let's say save file 1.
How can I load this save file 1 by js.

Thank you.
How do you mean load? Like through JS, the game save file 1 would load?

Bit more info would be needed, like what your plain or purpose with this? the reason, why I ask, is that most people that do request and request it be done through JS can easily be done with Events.
Filemanager.loadFromLocalFile in rpg_managers contains the answer.
How do you mean load? Like through JS, the game save file 1 would load?

Bit more info would be needed, like what your plain or purpose with this? the reason, why I ask, is that most people that do request and request it be done through JS can easily be done with Events.
Just like in scene load.
You select a file and you'll load.
I want to have a quest, when it fall, it will auto load the file.
Of course, I'll save the file at where I want it to restart.
Not just open the scene load is because I don't want player to choose the file.
You have also a way with nwJS NODE, its easy but it not compatible with Android.
Here the two way you can do, maybe more ?...

XMLHTTPRequest:
PHP:
    DataManager.loadDataFile = function(name, src) { // testter compatible android
    var xhr = new XMLHttpRequest();
    var url = 'data/' + src;
    xhr.open('GET', url);
    xhr.overrideMimeType('application/json');
    xhr.onload = function() {
        if (xhr.status < 400) {
            window[name] = JSON.parse(xhr.responseText);
            DataManager.onLoad(window[name]);
        }
    };
    xhr.onerror = this._mapLoader || function() {
        DataManager._errorUrl = DataManager._errorUrl || url;
    };
    window[name] = null;
    xhr.send();

Node: (it a copy paste from my source , but you need more study with consol.log variable, its more powerfull way, but not work on Android)
PHP:
        if(Utils.isNwjs()){ // if pc or mac linux TODO: ANDROID + loader
        var path = require('path'),
            gameDir = path.dirname(process.mainModule.filename),
            fs = require('fs');
        var valid_JSON = {};
        for (objName in this._aniObj) {
            if (typeof this._aniObj[objName] !== "object") { continue; }; // jumper valide name 'object'
            valid_JSON[objName] = [];
            for (var i = 0, len = this._aniObj[objName].json.length; i < len; i++) {
                var dirFile = this._aniObj[objName].json[i];
                if (fs.existsSync(gameDir + '/' + dirFile + '.json')) {
                    valid_JSON[objName].push(dirFile + '.json');
                    continue;
                };
                for (var num = 0;; num++) {
                    if (fs.existsSync(gameDir + '/' + dirFile + '-' + num + '.json')) {
                        valid_JSON[objName].push(dirFile + '-' + num + '.json');
                    } else { break; };
                };
            };
        };
        for (objName in valid_JSON) {
            Object.defineProperty(this._aniObj[objName], 'valid_JSON', { enumerable: false, configurable: false, value: valid_JSON[objName] });
        };

here a example for get your machine id in windows with open file in a buffer.
Easy for open a file , and read context buffer, this for made a custom keyGen or function evaluation from your saves DATA in JSON or another files extentions.
PHP:
var fs = require('fs');
var path = process.cwd();
var buffer = fs.readFileSync('C:\\Windows\\INF\\machine.inf');
console.log(buffer.toString());
index.php

after you can use a regex if you need read string in the file.
More info:
https://forums.rpgmakerweb.com/index.php?threads/node-js-machineid-solved.81127/#post-753862

In you specific case, you can read all save file and proprety from JSON as string, and use eval("string").
from the regex
You have also a way with nwJS NODE, its easy but it not compatible with Android.
Here the two way you can do, maybe more ?...

XMLHTTPRequest:
PHP:
    DataManager.loadDataFile = function(name, src) { // testter compatible android
    var xhr = new XMLHttpRequest();
    var url = 'data/' + src;
    xhr.open('GET', url);
    xhr.overrideMimeType('application/json');
    xhr.onload = function() {
        if (xhr.status < 400) {
            window[name] = JSON.parse(xhr.responseText);
            DataManager.onLoad(window[name]);
        }
    };
    xhr.onerror = this._mapLoader || function() {
        DataManager._errorUrl = DataManager._errorUrl || url;
    };
    window[name] = null;
    xhr.send();

Node: (it a copy paste from my source , but you need more study with consol.log variable, its more powerfull way, but not work on Android)
PHP:
        if(Utils.isNwjs()){ // if pc or mac linux TODO: ANDROID + loader
        var path = require('path'),
            gameDir = path.dirname(process.mainModule.filename),
            fs = require('fs');
        var valid_JSON = {};
        for (objName in this._aniObj) {
            if (typeof this._aniObj[objName] !== "object") { continue; }; // jumper valide name 'object'
            valid_JSON[objName] = [];
            for (var i = 0, len = this._aniObj[objName].json.length; i < len; i++) {
                var dirFile = this._aniObj[objName].json[i];
                if (fs.existsSync(gameDir + '/' + dirFile + '.json')) {
                    valid_JSON[objName].push(dirFile + '.json');
                    continue;
                };
                for (var num = 0;; num++) {
                    if (fs.existsSync(gameDir + '/' + dirFile + '-' + num + '.json')) {
                        valid_JSON[objName].push(dirFile + '-' + num + '.json');
                    } else { break; };
                };
            };
        };
        for (objName in valid_JSON) {
            Object.defineProperty(this._aniObj[objName], 'valid_JSON', { enumerable: false, configurable: false, value: valid_JSON[objName] });
        };

here a example for get your machine id in windows with open file in a buffer.
Easy for open a file , and read context buffer, this for made a custom keyGen or function evaluation from your saves DATA in JSON or another files extentions.
PHP:
var fs = require('fs');
var path = process.cwd();
var buffer = fs.readFileSync('C:\\Windows\\INF\\machine.inf');
console.log(buffer.toString());
index.php

after you can use a regex if you need read string in the file.
More info:
https://forums.rpgmakerweb.com/index.php?threads/node-js-machineid-solved.81127/#post-753862

In you specific case, you can read all save file and proprety from JSON as string, and use eval("string").
from the regex
Great!!
Thank you so much.
I did it with this.

Code:
DataManager.loadGame(id);
$gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
$gamePlayer.requestMapReload();
SceneManager.goto(Scene_Map);
$gameSystem.onAfterLoad();

Original thread: https://forums.rpgmakerweb.com/threads/how-to-load-file.88728/