Skip to main content

@terascope/file-asset-apis / base/chunked-file-sender / ChunkedFileSender

Abstract Class: ChunkedFileSender

Defined in: base/chunked-file-sender.ts:51

Extended by​

Constructors​

Constructor​

new ChunkedFileSender(type, config, logger): ChunkedFileSender

Defined in: base/chunked-file-sender.ts:60

Parameters​

ParameterType
typeFileSenderType
configChunkedFileSenderAPIConfig
loggerLogger

Returns​

ChunkedFileSender

Properties​

PropertyModifierTypeDefault valueDefined in
configreadonlyChunkedFileSenderAPIConfigundefinedbase/chunked-file-sender.ts:57
formatterprotectedFormatterundefinedbase/chunked-file-sender.ts:54
loggerreadonlyLoggerundefinedbase/chunked-file-sender.ts:58
pathListreadonlyMap<string, boolean>undefinedbase/chunked-file-sender.ts:55
sliceCountprotectednumber-1base/chunked-file-sender.ts:52
typereadonlyFileSenderTypeundefinedbase/chunked-file-sender.ts:56

Accessors​

concurrency​

Get Signature​

get concurrency(): number

Defined in: base/chunked-file-sender.ts:104

Returns​

number


filePerSlice​

Get Signature​

get filePerSlice(): boolean

Defined in: base/chunked-file-sender.ts:112

Returns​

boolean


format​

Get Signature​

get format(): Format

Defined in: base/chunked-file-sender.ts:116

Returns​

Format


id​

Get Signature​

get id(): string

Defined in: base/chunked-file-sender.ts:92

Returns​

string


isRouter​

Get Signature​

get isRouter(): boolean

Defined in: base/chunked-file-sender.ts:100

Returns​

boolean


lineDelimiter​

Get Signature​

get lineDelimiter(): string

Defined in: base/chunked-file-sender.ts:108

Returns​

string


nameOptions​

Get Signature​

get nameOptions(): NameOptions

Defined in: base/chunked-file-sender.ts:120

Returns​

NameOptions


path​

Get Signature​

get path(): string

Defined in: base/chunked-file-sender.ts:96

Returns​

string

Methods​

createFileDestinationName()​

createFileDestinationName(filePath): Promise<string>

Defined in: base/chunked-file-sender.ts:155

Ensures the root destination file path exists and returns the full destination file path.

Parameters​

ParameterType
filePathstring

Returns​

Promise<string>

Note​

this API might change since it should not have knowledge of the different sender types


incrementCount()​

protected incrementCount(): void

Defined in: base/chunked-file-sender.ts:237

Increases the internal sliceCount used to create filenames, this is already executed in the "send" method, do not use unless you are implementing your own send logic

Returns​

void


joinPath()​

protected joinPath(route?): string

Defined in: base/chunked-file-sender.ts:178

Method to help create proper file paths, mainly used in the abstract "verify" method

Parameters​

ParameterType
route?string

Returns​

string


prepareDispatch()​

prepareDispatch(data): Promise<SendBatchConfig[]>

Defined in: base/chunked-file-sender.ts:193

Batches records in a slice into groups based on the "path" config or by the DataEntity metadata 'standard:route' override if dynamic routing is being used, this is called in the "send" method

Parameters​

ParameterType
dataSendRecords

Returns​

Promise<SendBatchConfig[]>


send()​

send(records): Promise<number>

Defined in: base/chunked-file-sender.ts:252

Write data to file, uses parent "sendToDestination" method to determine location

Parameters​

ParameterType
recordsSendRecords

Returns​

Promise<number>

Example​

s3Sender.send([{ some: 'data' }]) => Promise<void>
s3Sender.send([DataEntity.make({ some: 'data' })]) => Promise<void>

sendStream()​

sendStream(bytes, options?): Promise<void>

Defined in: base/chunked-file-sender.ts:322

Write a file's bytes, already in the configured format, to one file (like simpleSend, at the "path" config). The bytes are sent as they arrive, in chunks, so the file is never all held: one chunk is a single write, more are a multipart upload with "concurrency" parts in flight. This is how a parquet file is sent; it works for any format whose bytes are made elsewhere. Compression is not supported, nothing to send writes no file. A chunk is chunkBytes, STREAM_CHUNK_SIZE_BYTES (8MiB) by default and never less than 5MiB

Parameters​

ParameterType
bytesSendBytes
options{ chunkBytes?: number; }
options.chunkBytes?number

Returns​

Promise<void>

Example​

s3Sender.sendStream(parquetBytes) => Promise<void>

sendToDestination()​

abstract protected sendToDestination(config): Promise<void>

Defined in: base/chunked-file-sender.ts:241

Parameters​

ParameterType
configSendBatchConfig

Returns​

Promise<void>


simpleSend()​

simpleSend(records): Promise<void>

Defined in: base/chunked-file-sender.ts:284

Write data to file, uses parent "sendToDestination" method to determine location. Use this to avoid having to bucket the data into different paths. Normally you don't want this but it can be used in specific case.

Parameters​

ParameterType
recordsSendRecords

Returns​

Promise<void>

Example​

s3Sender.simpleSend([{ some: 'data' }]) => Promise<void>
s3Sender.simpleSend([DataEntity.make({ some: 'data' })]) => Promise<void>

verify()​

abstract verify(path): Promise<void>

Defined in: base/chunked-file-sender.ts:130

Parameters​

ParameterType
pathstring

Returns​

Promise<void>