Split Types
Type definitions for Split in the DocuTray Node.js SDK — split status, segments, regions, parameters and type guards.
SplitStatusType
Possible statuses of a split. A split ends in SUCCESS or FAILED (not ERROR, unlike conversions).
type SplitStatusType = 'ENQUEUED' | 'PROCESSING' | 'SUCCESS' | 'FAILED';SplitConfidenceLevel
Confidence of a segment: the lowest among its parts.
type SplitConfidenceLevel = 'high' | 'medium' | 'low';SplitBox
A box on a page as displayed, from 0 to 1, origin at the top-left corner, without margin.
Prop
Type
SplitRegion
Beta. One part of a segment on one page.
Prop
Type
SplitSegmentDocumentType
Prop
Type
SplitSegment
One document found in the file. Segments follow the file in order and cover every page; two consecutive segments can share their border page.
Prop
Type
SplitEnqueued
Response of split.create(): the split was queued.
Prop
Type
SplitStatus
Status of a split (split.getStatus() and wait()). segments is present on SUCCESS and error on FAILED.
Prop
Type
SplitParams
Parameters for starting a split. Provide exactly one of file, url, or base64.
Prop
Type
Type Guards
isSplitComplete(status)
Returns true if the split reached a final status (SUCCESS or FAILED).
isSplitSuccess(status)
Returns true if the split succeeded; its segments are present.
isSplitFailed(status)
Returns true if the split failed. Its error is usually set, but can be null.
import { isSplitSuccess } from 'docutray';
if (isSplitSuccess(status)) {
console.log(status.segments.length);
}