add examples for crypto and zlib
Neue Datei |
| | |
| | | const crypto = require("crypto");
|
| | |
|
| | | const hash = cryptop.createHash(/* algorythm */); // "md5", "sha256"
|
Neue Datei |
| | |
| | | TEXTCOLLBYfGiJUETHQ4hAcKSMd5zYpgqf1YRDhkmxHkhPWptrkoyz28wnI9V0aHeAuaKnak
|
| | | TEXTCOLLBYfGiJUETHQ4hEcKSMd5zYpgqf1YRDhkmxHkhPWptrkoyz28wnI9V0aHeAuaKnak
|
Neue Datei |
| | |
| | | const zlib = require("zlib");
|
| | | const { pipeline } = require("stream");
|
| | |
|
| | | // Komprimieren
|
| | | zlib.deflate("abc" /* buffer | string */, (err, compressed) => {
|
| | |
|
| | | });
|
| | |
|
| | | // Dekomprimieren
|
| | | zlib.inflate(compressed /* buffer */, (err, decompressed) => {
|
| | |
|
| | | });
|
| | |
|
| | | // Als Stream
|
| | | const zipper = zlib.createDeflate();
|
| | | const unzipper = zlib.createInflate();
|
| | |
|
| | | source.pipe(zipper).pipe(target);
|
| | | source.pipe(unzipper).pipe(target);
|
| | |
|
| | | // einfachere Alternative
|
| | | pipeline(source, zipper, target, (err) => {
|
| | | console.error(err);
|
| | | });
|