- Any external tools and libraries are prohibited
- Use 18 LTS version of Node.js
- Don't change signature of pre-written functions (e.g. don't rename them, don't make them synchronous, etc.)
- Prefer asynchronous API whenever possible
You should implement several functions in dedicated files
create.js- implement function that creates new filefresh.txtwith contentI am fresh and younginside of thefilesfolder (if file already existsErrorwith messageFS operation failedmust be thrown)copy.js- implement function that copies folderfilesfiles with all its content into folderfiles_copyat the same level (iffilesfolder doesn't exists orfiles_copyhas already been createdErrorwith messageFS operation failedmust be thrown)rename.js- implement function that renames filewrongFilename.txttoproperFilenamewith extension.md(if there's no filewrongFilename.txtorproperFilename.mdalready existsErrorwith messageFS operation failedmust be thrown)delete.js- implement function that deletes filefileToRemove.txt(if there's no filefileToRemove.txtErrorwith messageFS operation failedmust be thrown)list.js- implement function that prints all array of filenames fromfilesfolder into console (iffilesfolder doesn't existsErrorwith messageFS operation failedmust be thrown)read.js- implement function that prints content of thefileToRead.txtinto console (if there's no filefileToRead.txtErrorwith messageFS operation failedmust be thrown)
You should implement several functions in dedicated files
env.js- implement function that parses environment variables with prefixRSS_and prints them to the console in the formatRSS_name1=value1; RSS_name2=value2args.js- implement function that parses command line arguments (given in format--propName value --prop2Name value2, you don't need to validate it) and prints them to the console in the formatpropName is value, prop2Name is value2
You should refactor file (you can add additional imports if needed)
cjsToEsm.cjs- rewrite it to it's equivalent in ECMAScript notation (and rename it toesm.mjs)
You should implement several functions in dedicated files
calcHash.js- implement function that calculates SHA256 hash for filefileToCalculateHashFor.txtand logs it into console ashex
You should implement several functions in dedicated files
read.js- implement function that reads filefileToRead.txtcontent using Readable Stream and prints it's content intoprocess.stdoutwrite.js- implement function that writesprocess.stdindata into filefileToWrite.txtcontent using Writable Streamtransform.js- implement function that reads data fromprocess.stdin, reverses text using Transform Stream and then writes it intoprocess.stdout
You should implement several functions in dedicated files
compress.js- implement function that compresses filefileToCompress.txttoarchive.gzusingzliband Streams APIdecompress.js- implement function that decompressesarchive.gzback to thefileToCompress.txtwith same content as before compression usingzliband Streams API
You should implement several functions in dedicated files
worker.js- extend given function to work with data received from main thread and implement function which sends result of the computation to the main threadmain.js- implement function that creates number of worker threads (equal to the number of host machine logical CPU cores) from fileworker.jsand able to send data to those threads and to receive result of the computation from them. You should send incremental number starting from10to 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 fromworkeror'error'in case of error inworkerdata- value fromworkerin case of success ornullin case of error in worker
The results in the array must be in the same order that the workers were created
You should implement several functions in dedicated files
cp.js- implement functionspawnChildProcessthat receives array of argumentsargsand creates child process from filescript.js, passing theseargsto it. This function should create IPC-channel betweenstdinandstdoutof master process and child process:- child process
stdinshould receive input from master processstdin - child process
stdoutshould send data to master processstdout
- child process