Documark Cache
Documark helper functions for working with cache files.
When running var cache = require('documark-cache')(document);
the following happens:
- The cache helper will use given
document
for resolving paths - A cache folder (
.documark/
) will be created in your document directory - This directory will also be set as WkHTMLToPDF its
--cache-dir
Usage
-
Load cache helper:
var cache = document; -
Use the cache helper in your plugins:
module {var cache = document;// Folder path:var folderPath = cache;// Path to <document root>/.documark/// File path:var filePath = cache;// Path to <document root>/.documark/myfile.json// Read file:var file = cache;file;file;file;// Or pipe to other stream: file.pipe(other);// Write to file:var file = cache;file
Note: Use file.path
to get read/write stream its file path.