LocalFile

Atalasoft.Controls.Capture.WebScanning. LocalFile

Local files are stored in this folder:

  • On Windows: %LOCALAPPDATA%\Kofax\WebCapture\Persistent
  • On macOS: /Users/<current user>/Library/WebCapture

The file names follow this pattern:

(T|U)-.elf

T indicates a trusted file – WebCapture generated the contents.

U indicates an untrusted file – contents came from outside the plugin e.g. via LocalFile.fromBase64String

The session-id is generated each time the plugin is instantiated, and should be unique on any given computer for ~13 years.

The filenumber is generated sequentially within each session, starting from 1.

.elf stands for Encrypted Local File.

Methods

(static) asBase64String(fid, formatopt, optionsopt, callbackopt) → {string|undefined}

Decrypts a locally-saved file and returns it as a base64-encoded string.

If format is specified, returns the data in the specified file format. If format is absent or same as the one used to create encrypted local file, data is returned without un-compression.

If no encryption key has been set, throws an exception.

Parameters:
Name Type Description
fid string

Local file identifier.

[format] string

File format to use.

[options] DeliverablesConfig

Additional file options.

[callback] imageDataCallback

Completion callback function. If not passed, method is executed synchronously.

Returns:

Image data if executed synchronously; undefined otherwise.

Type
string | undefined

(static) fromBase64String(base64, callbackopt) → {string|undefined}

Saves the specified base64-encoded binary data to an encrypted local file, and returns a unique file-identifier for that local file.

Parameters:
Name Type Description
base64 string

Base64 data to save.

[callback] saveLocalFileCallback

Completion callback function.

Returns:

created local file identifier if executed synchronously; undefined otherwise.

Type
string | undefined

(static) globalPurgeByAge(hours, callbackopt) → {undefined}

Immediately deletes all local files written more than hours ago. Deletes ALL local files meeting the age criterion, no matter how or when they were created, or by which instance of WingScan. Obviously, use with caution.

Parameters:
Name Type Description
hours number

Age of local files, in hours.

[callback] function

Completion callback function.

Returns:
Type
undefined

(static) list(callbackopt) → {Array.<string>|undefined}

Returns an array of the identifiers of all the existing saved local files associated with this instance of WingScan.

Parameters:
Name Type Description
[callback] function

Completion callback function. Array of encrypted local file identifiers is passed as the parameter.

Returns:

Array of encrypted local file identifiers if executed synchronously; undefined otherwise.

Type
Array.<string> | undefined

(static) remove(fid, callbackopt) → {undefined}

Immediately deletes a local file and any data associated with it. This is irreversible and non-recoverable.

Parameters:
Name Type Description
fid string

Local file identifier.

[callback] function

Completion callback function.

Returns:
Type
undefined

(static) removeAll(callbackopt) → {undefined}

Immediately deletes all local files associated with (created by) this instance of WingScan. Has no effect on local files created in other instances of the client application, or files created by previous incarnations of WingScan.

Parameters:
Name Type Description
[callback] function

Completion callback function.

Returns:
Type
undefined

(static) setEncryptionKey(key, callbackopt) → {undefined}

Sets the encryption key for subsequent encrypted local file load/saves. The basis is an arbitrary string, which is used to generate the symmetric encryption key.

The basis is immediately discarded, and the generated key is moved into the Windows secure cryptographic storage.

macOS version of Web Capture Service does not use encryption key

Parameters:
Name Type Description
key string

Basis for the encryption key.

[callback] function

Completion callback function.

Returns:
Type
undefined

(static) splitToFiles(fid, optionsopt, callback)

Splits the existing encrypted local file to a set of blobs of the specified size. Each blobs is stored as new encrypted local file.

Existing local file is unencrypted and split with no regards to content format, i.e. each chunk is a blob part of the original file, and don't have any application meaning itself until those chunks are combined back.

The purpose of such feature is to allow big files, mostly imported PDF or eDocs to pass through 32bit browser and be uploaded to the destination web server. So each chunk could be uploaded individually and then they should be combined and stored according to application logic.

Parameters:
Name Type Description
fid string

Local file identifier.

[options] Object

File split options.

Properties
Name Type Description
size number

Size of the individual chunk in bytes.

removeSource boolean

Flag indicating whether slitted file should be deleted.

callback splitToFilesCallback

Callback function that accepts chunks identifiers.