You should implement several functions in dedicated files
- create.js - implement function that creates new file fresh.txt with content
I am fresh and younginside of the files folder (if file already exists Error with messageFS operation failedmust be thrown) - copy.js - implement function that copies folder
fileswith all its content into folderfiles_copyat the same level (iffilesfolder doesn't exist orfiles_copyhas already been created Error with messageFS operation failedmust be thrown) - rename.js - implement function that renames file
wrongFilename.txttoproperFilenamewith extension.md(if there's no filewrongFilename.txtorproperFilename.mdalready exists Error with messageFS operation failedmust be thrown) - delete.js - implement function that deletes file
fileToRemove.txt(if there's no filefileToRemove.txtError with messageFS operation failedmust be thrown) - list.js - implement function that prints array of all filenames from
filesfolder into console (iffilesfolder doesn't exists Error with messageFS operation failedmust be thrown) - read.js - implement function that prints content of the
fileToRead.txtinto console (if there's no filefileToRead.txtError with messageFS operation failedmust be thrown)
You should implement several functions in dedicated files
- env.js - implement function that parses environment variables with prefix
RSS_and prints them to the console in the formatRSS_name1=value1; RSS_name2=value2 - args.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 to
esm.mjs)
You should implement several functions in dedicated files
- calcHash.js - implement function that calculates SHA256 hash for file
fileToCalculateHashFor.txtand logs it into console as hex using Streams API
You should implement several functions in dedicated files
- read.js - implement function that reads file
fileToRead.txtcontent using Readable Stream and prints it's content intoprocess.stdout - write.js - implement function that writes
process.stdindata into filefileToWrite.txtcontent using Writable Stream - transform.js - implement function that reads data from
process.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 file
fileToCompress.txttoarchive.gzusing zlib and Streams API - decompress.js - implement function that decompresses
archive.gzback to thefileToCompress.txtwith same content as before compression using zlib and 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 thread
- main.js - implement function that creates number of worker threads (equal to the number of host machine logical CPU cores) from file
worker.jsand able to send data to those threads and to receive result of the computation from them. You should send incremental number starting from 10 to each worker. For example: on host machine with 4 cores you should create 4 workers and send 10 to first worker, 11 to second worker, 12 to third worker, 13 to fourth worker. 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 from worker or 'error' in case of error in workerdata- value from worker in 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 function
spawnChildProcessthat receives array of argumentsargsand creates child process from filescript.js, passing theseargsto it. This function should create IPC-channel between stdin and stdout of master process and child process:- child process stdin should receive input from master process stdin
- child process stdout should send data to master process stdout