@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
| Parameter | Type |
|---|---|
type | FileSenderType |
config | ChunkedFileSenderAPIConfig |
logger | Logger |
Returns
ChunkedFileSender
Properties
| Property | Modifier | Type | Default value | Defined in |
|---|---|---|---|---|
config | readonly | ChunkedFileSenderAPIConfig | undefined | base/chunked-file-sender.ts:57 |
formatter | protected | Formatter | undefined | base/chunked-file-sender.ts:54 |
logger | readonly | Logger | undefined | base/chunked-file-sender.ts:58 |
pathList | readonly | Map<string, boolean> | undefined | base/chunked-file-sender.ts:55 |
sliceCount | protected | number | -1 | base/chunked-file-sender.ts:52 |
type | readonly | FileSenderType | undefined | base/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
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
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
| Parameter | Type |
|---|---|
filePath | string |
Returns
Promise<string>
Note
this API might change since it should not have knowledge of the different sender types
incrementCount()
protectedincrementCount():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()
protectedjoinPath(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
| Parameter | Type |
|---|---|
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
| Parameter | Type |
|---|---|
data | SendRecords |
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
| Parameter | Type |
|---|---|
records | SendRecords |
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
| Parameter | Type |
|---|---|
bytes | SendBytes |
options | { chunkBytes?: number; } |
options.chunkBytes? | number |
Returns
Promise<void>
Example
s3Sender.sendStream(parquetBytes) => Promise<void>
sendToDestination()
abstractprotectedsendToDestination(config):Promise<void>
Defined in: base/chunked-file-sender.ts:241
Parameters
| Parameter | Type |
|---|---|
config | SendBatchConfig |
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
| Parameter | Type |
|---|---|
records | SendRecords |
Returns
Promise<void>
Example
s3Sender.simpleSend([{ some: 'data' }]) => Promise<void>
s3Sender.simpleSend([DataEntity.make({ some: 'data' })]) => Promise<void>
verify()
abstractverify(path):Promise<void>
Defined in: base/chunked-file-sender.ts:130
Parameters
| Parameter | Type |
|---|---|
path | string |
Returns
Promise<void>