Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sakalx/encrypt
Encrypt project or file via gulp
https://github.com/sakalx/encrypt
encrypt encryption encryptor gulp
Last synced: 29 days ago
JSON representation
Encrypt project or file via gulp
- Host: GitHub
- URL: https://github.com/sakalx/encrypt
- Owner: sakalx
- Created: 2018-06-08T00:49:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-08T14:01:27.000Z (over 6 years ago)
- Last Synced: 2024-12-16T20:14:18.514Z (about 2 months ago)
- Topics: encrypt, encryption, encryptor, gulp
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Encryption for file, folders or whole project via gulp
### Instaling:
> npm i encryption-gulp -D
________________________________________________________
________________________________________________________#### Props
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| **password** | `string` | *password* | you secret password for encrypting / decrypting |
| **decrypt** | `boolean` | *false* | is should do decryption |________________________________________________________
________________________________________________________### Usage encryption for one file
in your gulpfile.js:
```javascript
const gulp = require('gulp');
const encryption = require('encryption-gulp');gulp.task('encrypt', function() {
gulp.src('src/index.js')
.pipe(encryption({
password: 'password',
decrypt: false,
}))
.pipe(gulp.dest('dist-enc'));
});```
### Usage encryption for whole project
```javascript
const gulp = require('gulp');
const encryption = require('encryption-gulp');gulp.task('encrypt', function() {
gulp.src('src/**/*')
.pipe(encryption({
password: 'password',
decrypt: false,
}))
.pipe(gulp.dest('dist-enc'));
});
```### Usage decryption
just need set `decrypt: true`
```javascript
const gulp = require('gulp');
const encryption = require('encryption-gulp');gulp.task('decryption', function() {
gulp.src('dist-enc/index.js')
.pipe(encryption({
password: 'password',
decrypt: true,
}))
.pipe(gulp.dest('src-dec'));
});
```
________________________________________________________
________________________________________________________
> One more example, **all together now**
```javascript
const gulp = require('gulp');
const encryption = require('encryption-gulp');const KEY = require('./KEY');
const path = {
decrypted: 'src-decrypted',
encrypted: 'src-encrypted',
};const pathSrc = {
assets: ['src/**/*', '!src/**/*.js'],
js: 'src/**/*.js',
};const pathEncrypt = {
assets: [`${path.encrypted}/**/*`, `!${path.encrypted}/**/*.js`],
js: `${path.encrypted}/**/*.js`,
};const encrypt = (pathIn, pathOut, decrypt) => {
gulp.src(pathIn)
.pipe(encryption({
password: KEY,
decrypt: decrypt,
}))
.pipe(gulp.dest(pathOut));
};const assets = (pathIn, pathOut) => {
gulp.src(pathIn)
.pipe(gulp.dest(pathOut));
};gulp.task('addAssetsSrc', () => assets(pathSrc.assets, path.encrypted));
gulp.task('addAssetsEncrypt', () => assets(pathEncrypt.assets, path.decrypted));gulp.task('encrypting', ['addAssetsSrc'], () => encrypt(pathSrc.js, path.encrypted, false));
gulp.task('decrypting', ['addAssetsEncrypt'], () => encrypt(pathEncrypt.js, path.decrypted, true));
```________________________________________________________
________________________________________________________
If you have any issue go here
**[ISSUES](https://github.com/sakalx/encrypt/issues)**
________________________________________________________
________________________________________________________
License
----MIT
**Free, Hell Yeah! 😈**