TDFCiphertextStream

TDFCiphertextStream

A Readable stream implementation that exposes convenience methods for writing TDF ciphertext to various locations like files and strings.
 // Run an encrypt, which returns a TDFCiphertextStream.
 ciphertextStream = await client.encrypt(encryptParams);

 // Write the TDF ciphertext to a local file.
 await stream.toFile("/tmp/plain.tdf");
   

Methods

(async) toBuffer() → {Buffer}

Dump the stream content to a buffer. This will consume the stream.
Returns:
- the TDF ciphertext in Buffer form.
Type
Buffer

(async) toFile(filepath)

Dump the stream content to a local file. This will consume the stream.
Parameters:
Name Type Description
filepath string the path of the local file to write TDF ciphertext to.

(async) toString() → {string}

Dump the stream content to a string. This will consume the stream.
Returns:
- the TDF ciphertext in string form, encoded as binary.
Type
string