live-directory
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "live-directory", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A Simple-To-Use Dynamic Template Content Manager For Webservers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -178,3 +178,4 @@ # LiveDirectory: Dynamic File Content Manager | ||
| `path` | `String` | System file path. | | ||
| `content` | `String` | File text content. | | ||
| `content` | `Buffer` | File raw content. | | ||
| `content_string` | `String` | File content in `String` format. | | ||
| `last_update` | `Number` | Last file text content update timestamp in **milliseconds** | | ||
@@ -181,0 +182,0 @@ |
@@ -7,2 +7,3 @@ const FileSystem = require('fs'); | ||
#content; | ||
#content_string; | ||
#watcher; | ||
@@ -31,13 +32,2 @@ #watcher_delay; | ||
/** | ||
* This method can be used to overwrite/update the content of a file. | ||
* This is useful for applying your post-processing on the reload event | ||
* and then updating the newly read content. | ||
* | ||
* @param {String} content | ||
*/ | ||
set_content(content) { | ||
this.#content = content; | ||
} | ||
/** | ||
* This method can be used to set/update the render function for current live file. | ||
@@ -124,2 +114,3 @@ * | ||
reference.#content = content; | ||
reference.#content_string = content.toString(); | ||
reference.#handlers.reload(content); | ||
@@ -135,3 +126,4 @@ }); | ||
this.#watcher.close(); | ||
this.#content = ''; | ||
this.#content = Buffer.from(''); | ||
this.#content_string = ''; | ||
} | ||
@@ -152,2 +144,6 @@ | ||
get content_string() { | ||
return this.#content_string; | ||
} | ||
get last_update() { | ||
@@ -154,0 +150,0 @@ return this.#last_update; |
190
33764
634