@sugarcube/plugin-fs
v0.42.1
Published
Operate on the file system.
Downloads
16
Maintainers
Readme
@sugarcube/plugin-fs
Interact with the file system.
Installation
npm install --save @sugarcube/plugin-fs
Plugins
fs_import
The query type is glob_pattern
. It expands the glob pattern and turns every file into an unit. If possible, it extracts the body and meta data from the file using Apache Tika.
Example:
sugarcube -Q glob_pattern:path/to/files/** -p fs_import
Configuration:
fs.extract_language
: Set the language to use for OCR extraction. The language code must be a ISO 839-2 3 letter code and supported by Tesseract. Make sure to install the language pack for Tesseract as well. Example languages are:eng
for English,deu
for German andara
for Arabic. The default language iseng
.
Metrics:
total
: The total number of files imported.fail
: The number of files that failed to import.success
: The number files that succeeded to import.
fs_from_json
The query type is glob_pattern
. It expands the glob pattern and import each file as a JSON file. The contents of the JSON files are imported as units of data.
Example:
sugarcube -Q glob_pattern:path/to/files/*.json -p fs_from_json
Configuration:
This plugin offers no configuration.
Metrics:
total
: The total number of units imported.fail
: The number of files that failed to import.success
: The number of units that succeeded to import.
API
unfold
Unfold a glob pattern into a list of file objects.
unfold :: String -> Future [a]
Parameters
pattern
string A glob file pattern.
Returns Promise<Array<Object>> A list of file objects. Contains location, sha256 and md5 sums.