New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cryption

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cryption

Node.js 加解密流数据

latest
Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

cryption 流数据加解密

安装

npm install cryption

用处

提供流的数据加解密接口:

const cryption = require('cryption');
const fs = require('fs');

(async () => {
  // 加密
  const input = fs.createReadStream('/input.txt');
  const output = fs.createWriteStream('/encoded.txt');
  await cryption.encode({ readable: input, writable: output, algorithm: 'aes192', password: 'password' });

  // 解密
  const input = fs.createReadStream('/encoded.txt');
  const output = fs.createWriteStream('/output.txt');
  await cryption.decode({ readable: input, writable: output, algorithm: 'aes192', password: 'password' });
})();

命令行

先全局安装

npm install cryption -g

用处

  Usage: cryp [options] [command]


  Options:

    -v --version  output the version number
    -h, --help    output usage information


  Commands:

    encode [options] [file]  加密文件
    decode [options] [file]  解密文件
    *                        show help
      encode decode options:
      -a --algorithm <algo> 选择算法
      -p --password <pass> 自定义加密或解密密码
      -r --retain 是否保留源文件

举例

加密

加密本文件夹下的文件input.txt

cryp encode ./input.txt

自定义加密密码加密:

cryp encode -p secret ./input.txt

解密

解密本文件夹下的文件input.txt

cryp encode ./input.txt.cryp

自定义解密密码加密:

cryp encode -p secret ./input.txt.cryp

FAQs

Package last updated on 02 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts