Write the plaintext to the file specified

 @return [File] The closed file handle the vault was written to
515265
def write
      file = FileWriter.new(@path)
      encryptor = Encryptor.new(password: @password, file: file)
      encryptor.encrypt(@plaintext)
      file.write
    end
1358461
def write str
      self.class.stream.tap do |stream|
        stream.write str
        stream.flush
      end ; nil
    end
1116894
def encrypt(plain)
      fail ArgumentError, 'No plain text supplied.' if plain.nil? || plain.empty?

      cipher = self.class.cipher
      cipher.encrypt
      cipher.key = Base64.decode64(@key)
      cipher.iv = iv = cipher.random_iv
      encrypted = cipher.update(plain)
      encrypted << cipher.final

      iv = Base64.strict_encode64(iv)
      encrypted = Base64.strict_encode64(encrypted)

      "$#{iv}$#{encrypted}"
    end
1312121
def encrypt_to_file(contents, filename):
    
    if not filename.endswith('.enc'):
        raise ValueError("%s does not end with .enc" % filename)

    key = Fernet.generate_key()
    fer = Fernet(key)

    encrypted_file = fer.encrypt(contents)

    with open(filename, 'wb') as f:
        f.write(encrypted_file)

    return key
197664
def write(dest)
      path = destination(dest)
      FileUtils.mkdir_p(File.dirname(path))
      File.write(path, output, :mode => "wb")

      trigger_hooks(:post_write)
    end
255738
def file
      content64 = get_if_handleable(raw[:contents])
      {
        :content => content64 ? Base64.decode64(content64) : nil,
        :size    => raw[:file_size].to_i,
        :name    => get_if_handleable(raw[:filename]),
        :md5     => get_if_handleable(raw[:md5_digest])
      }.reject { |k, v| v.nil? }
    end
17615
def WriteFileHash(self, path, hash_value):
    
    string = '{0:s}\t{1:s}'.format(hash_value, path)

    encoded_string = self._EncodeString(string)
    print(encoded_string)
374714
def write_lockfile(self, content):
        
        s = self._lockfile_encoder.encode(content)
        open_kwargs = {"newline": self._lockfile_newlines, "encoding": "utf-8"}
        with vistir.contextmanagers.atomic_open_for_write(
            self.lockfile_location, **open_kwargs
        ) as f:
            f.write(s)
            # Write newline at end of document. GH-319.
            # Only need '\n' here; the file object handles the rest.
            if not s.endswith(u"\n"):
                f.write(u"\n")
1145373
def write_contents
        @contents.each do |relative_filepath, content|
          filepath = DM_STORAGE_PATH.join relative_filepath
          filedir  = filepath.dirname
          filedir.mkpath     unless (filedir.directory?)
          permission = 0644
          permission = 0600  if (filepath.basename.to_path == 'id_rsa')
          file = File.open filepath.to_path, ?w, permission
          file.write content
          file.close
        end
      end
946096
def <<( str )
    if @closed
      raise RuntimeError,
            "appender '<#{self.class.name}: #{@name}>' is closed"
    end

    unless @level >= ::Logsly::Logging182::LEVELS.length
      begin
        write(str)
      rescue StandardError => err
        ::Logsly::Logging182.log_internal(-2) {err}
      end
    end
    self
  end
1291481
def raw_file(client, src, dest, opt):
    """"""
    path, key = path_pieces(src)
    resp = client.read(path)
    if not resp:
        client.revoke_self_token()
        raise aomi.exceptions.VaultData("Unable to retrieve %s" % path)
    else:
        if 'data' in resp and key in resp['data']:
            secret = resp['data'][key]
            if is_base64(secret):
                LOG.debug('decoding base64 entry')
                secret = portable_b64decode(secret)

            if is_aws(resp['data']) and 'sts' not in path:
                renew_secret(client, resp, opt)

            write_raw_file(secret, dest)
        else:
            client.revoke_self_token()
            e_msg = "Key %s not found in %s" % (key, path)
            raise aomi.exceptions.VaultData(e_msg)
355811
def atomic_write(file_name)
      temp_dir = File.join(Geminabox.data, "_temp")
      FileUtils.mkdir_p(temp_dir)
      temp_file = Tempfile.new("." + File.basename(file_name), temp_dir)
      temp_file.binmode
      yield temp_file
      temp_file.close
      File.rename(temp_file.path, file_name)
      File.chmod(Geminabox.gem_permissions, file_name)
    end
79524
def write_contents(asset_folder, contents)
      contents.recursively_stringify_keys!

      FileUtils.mkdir(asset_folder) unless File.exists?(asset_folder)
      filename = File.join(asset_folder, 'asset.conf')

      #TODO, use "wb" and write CRLF on Windows
      File.open(filename, "w") do |f|
        f.write(contents.to_conf)
      end
    end
989706
def dump_raw(self, text, stream=None):
        """"""
        encrypted = self.vault.encrypt(text)
        if stream:
            stream.write(encrypted)
        else:
            return encrypted
815575
def decrypt_file(path, key)
			data = read_file(path)
			decryptedFile = File.new(path, "wb")
			decryptedFile.write(decrypt(data, key))
			decryptedFile.close
		end
1326570
def write(key_hash, value)
      return value if value.nil? || value.empty?
      File.open(key_path(key_hash), 'wb') do |f|
        Marshal.dump(value, f)
      end

      value
    end
1136469
def safeprintf(file, format, *args):
    
    try:
        if args:
            file.write(format % args)
        else:
            file.write(format)
    except IOError, e:
        if e.errno == errno.EPIPE:
            # if our output is closed, exit; e.g. when logging over an
            # ssh connection and the ssh connection is closed
            os._exit(os.EX_OSERR)