1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #3139 from node-red/fs-promises

Fixes to fs promises so that an electron built version runs
This commit is contained in:
Nick O'Leary 2021-09-27 17:51:10 +01:00 committed by GitHub
commit 068f425833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@
* limitations under the License.
**/
var fs = require('fs-extra');
var fs = require('fs');
var fspath = require('path');
var runtime;
@ -25,7 +25,7 @@ var exampleFlows = null;
async function getFlowsFromPath(path) {
var result = {};
var validFiles = [];
return fs.readdir(path).then(files => {
return fs.promises.readdir(path).then(files => {
var promises = [];
if (files) {
files.forEach(function(file) {

View File

@ -23,7 +23,7 @@
var i18n = require("i18next");
var path = require("path");
var fs = require("fs-extra");
var fs = require("fs");
var defaultLang = "en-US";
@ -89,7 +89,7 @@ async function readFile(lng, ns) {
return resourceCache[ns][lng];
} else if (resourceMap[ns]) {
const file = path.join(resourceMap[ns].basedir, lng, resourceMap[ns].file);
const content = await fs.readFile(file, "utf8");
const content = await fs.promises.readFile(file, "utf8");
resourceCache[ns] = resourceCache[ns] || {};
resourceCache[ns][lng] = JSON.parse(content.replace(/^\uFEFF/, ''));
var baseLng = lng.split('-')[0];