create.js
- function that creates new filefresh.txt
with contentI am fresh and young
inside of thefiles
folder (if file already existsError
with messageFS operation failed
thrown)copy.js
- function that copies folderfiles
files with all its content into folderfiles_copy
at the same level (iffiles
folder doesn't exists orfiles_copy
has already been createdError
with messageFS operation failed
thrown)rename.js
- function that renames filewrongFilename.txt
toproperFilename
with extension.md
(if there's no filewrongFilename.txt
orproperFilename.md
already existsError
with messageFS operation failed
thrown)delete.js
- function that deletes filefileToRemove.txt
(if there's no filefileToRemove.txt
Error
with messageFS operation failed
thrown)list.js
- function that prints all array of filenames fromfiles
folder into console (iffiles
folder doesn't existsError
with messageFS operation failed
thrown)read.js
- function that prints content of thefileToRead.txt
into console (if there's no filefileToRead.txt
Error
with messageFS operation failed
thrown)
env.js
- function that parses environment variables with prefixRSS_
and prints them to the console in the formatRSS_name1=value1; RSS_name2=value2
args.js
- function that parses command line arguments (given in format--propName value --prop2Name value2
) and prints them to the console in the formatpropName is value, prop2Name is value2
cjsToEsm.cjs
- rewriting equivalent in ECMAScript notation (and rename it toesm.mjs
)
calcHash.js
- function that calculates SHA256 hash for filefileToCalculateHashFor.txt
and logs it into console ashex
read.js
- function that reads filefileToRead.txt
content using Readable Stream and prints it's content intoprocess.stdout
write.js
- function that writesprocess.stdin
data into filefileToWrite.txt
content using Writable Streamtransform.js
- function that reads data fromprocess.stdin
, reverses text using Transform Stream and then writes it intoprocess.stdout
compress.js
- function that compresses filefileToCompress.txt
toarchive.gz
usingzlib
and Streams APIdecompress.js
- function that decompressesarchive.gz
back to thefileToCompress.txt
with same content as before compression usingzlib
and Streams API
worker.js
- function works with data received from main thread and implement function which sends result of the computation to the main threadmain.js
- function that creates number of worker threads (equal to the number of host machine logical CPU cores) from fileworker.js
and able to send data to those threads and to receive result of the computation from them. You should send incremental number starting from10
to eachworker
. For example: on host machine with 4 cores you should create 4 workers and send 10 to firstworker
, 11 to secondworker
, 12 to thirdworker
, 13 to fourthworker
. After all workers will finish, function should log array of results into console. The results are array of objects with 2 properties:status
-'resolved'
in case of successfully received value fromworker
or'error'
in case of error inworker
data
- value fromworker
in case of success ornull
in case of error in worker
The results in the array must be in the same order that the workers were created
cp.js
- functionspawnChildProcess
that receives array of argumentsargs
and creates child process from filescript.js
, passing theseargs
to it. This function should create IPC-channel betweenstdin
andstdout
of master process and child process:- child process
stdin
should receive input from master processstdin
- child process
stdout
should send data to master processstdout
- child process