Sha256: 9a78e48e07022932b97365b66674e4afa8cf5520368c4c90a16e4f16c1071a60

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

module IOStreams
  module SymmetricEncryption
    class Writer < IOStreams::Writer
      # Write to stream using Symmetric Encryption
      # By default the output stream is compressed.
      # If the input_stream is already compressed consider setting compress: false.
      def self.stream(input_stream, compress: true, **args, &block)
        unless defined?(SymmetricEncryption)
          Utils.load_dependency('symmetric-encryption', '.enc streaming')
        end

        ::SymmetricEncryption::Writer.open(input_stream, compress: compress, **args, &block)
      end

      # Write to stream using Symmetric Encryption
      # By default the output stream is compressed unless the file_name extension indicates the file is already compressed.
      def self.file(file_name, compress: nil, **args, &block)
        unless defined?(SymmetricEncryption)
          Utils.load_dependency('symmetric-encryption', '.enc streaming')
        end

        ::SymmetricEncryption::Writer.open(file_name, compress: compress, **args, &block)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iostreams-1.0.0.beta2 lib/io_streams/symmetric_encryption/writer.rb
iostreams-1.0.0.beta lib/io_streams/symmetric_encryption/writer.rb