-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from wpdas/feature/core-improvement-beta-23
Feature: Core improvement for Beta 23
- Loading branch information
Showing
12 changed files
with
236 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Recurso criado para melhorar o desempenho durante o desenvolvimento e ler novamente somente | ||
* os arquivos que foram alterados. | ||
*/ | ||
|
||
const fs = require("fs"); | ||
|
||
const filesContentCache = {}; | ||
|
||
const getFileContent = (filePath) => { | ||
// First, try to return the cached content | ||
if (filesContentCache[filePath]) { | ||
return filesContentCache[filePath]; | ||
} | ||
|
||
// If there's no cache, read file, save cache and return the file content | ||
let fileContent = fs.readFileSync(filePath, "utf8"); | ||
filesContentCache[filePath] = fileContent; | ||
|
||
return fileContent; | ||
}; | ||
|
||
const updateFileContent = (filePath) => { | ||
// Read file and save in cache | ||
let fileContent = fs.readFileSync(filePath, "utf8"); | ||
filesContentCache[filePath] = fileContent; | ||
}; | ||
|
||
module.exports = { | ||
getFileContent, | ||
updateFileContent, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.