feat: added 03_dom
This commit is contained in:
8769
02_advanced/uebungen/u29_stream/data/products.html
Normal file
8769
02_advanced/uebungen/u29_stream/data/products.html
Normal file
File diff suppressed because it is too large
Load Diff
BIN
02_advanced/uebungen/u29_stream/data/products.html.gz
Normal file
BIN
02_advanced/uebungen/u29_stream/data/products.html.gz
Normal file
Binary file not shown.
21
02_advanced/uebungen/u29_stream/index.js
Normal file
21
02_advanced/uebungen/u29_stream/index.js
Normal file
@@ -0,0 +1,21 @@
|
||||
// const fs = require('node:fs');
|
||||
// const zlib = require('node:zlib');
|
||||
import fs from 'node:fs';
|
||||
import zlib from 'node:zlib';
|
||||
|
||||
const gzipCompressor = zlib.createGzip();
|
||||
|
||||
const inputStream = fs.createReadStream('data/products.html');
|
||||
const outputStream = fs.createWriteStream('data/products.html.gz');
|
||||
|
||||
inputStream.on('data', (data) => {
|
||||
console.log('Pakete (data chunks) werden geladen: ', data.length);
|
||||
//outputStream.write(zlib.gzipSync(data));
|
||||
});
|
||||
|
||||
inputStream.pipe(gzipCompressor).pipe(outputStream);
|
||||
|
||||
// Übung 29: Datenströme
|
||||
// Schreibe Codebeispiel 239 um, ohne die Funktion pipe(…) zu verwenden!
|
||||
|
||||
// TIPP: Um eine Datei päckchenweise lesen- und schreiben zu können, gibt es für das fs Modul die Methoden createReadStream und createWriteStream.
|
||||
13
02_advanced/uebungen/u29_stream/package.json
Normal file
13
02_advanced/uebungen/u29_stream/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "03_stream",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"type": "module"
|
||||
}
|
||||
Reference in New Issue
Block a user