1.0.2 • Published 4 years ago

hans-files-cryptor v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

hans-files-cryptor

file cryptor with hans-cryptor for node.js

Table of contents

Features

  • encrypting and decrypting strings by password using Vigenere method

Installing Add the package to your project

npm i hans-files-cryptor

Example

Export fileCrypt from hans-files-cryptor

const fileCrypt = require('hans-files-cryptor')

using TypeScript

import fileCrypt from 'hans-files-cryptor'

encryptObjectAndWriteTextFile

type UserType = {id: string, name: string}
const obj = {id: 'spme id', name: 'Hans'}
const filePath = './encryptedFiles/hansUser.dat'
const key = 'some key'
encryptObjectAndWriteTextFile(obj, filePath, key)

decryptTextFileAndParse

const obj = decryptTextFileAndParse<UserType>(filePath, key)
console.log(obj) // Object {id: string, name: string}