I was wondering if there was any file_get_contents()
equivalents in Node.JS modules or elsewhere. It has to lock the process until the download is finished, so the existing request()
code in Node.js won't work. While it doesn't need to read into the string, the locking, synchronous nature is important.
If this doesn't exist, is using CURL via the OS module an efficient way of handling the same process?
So, in short: You dont need Nginx or Apache at all, but you can use if you want. It's very cosy to some people use Nginx to do the load balance, or even other stuff like handle the https or server static content. It's your choice at the end.
If you've ever written tests for a Node. js application, chances are you used an external library. However, you don't need a library to run unit tests in Javascript.
Unit Testing is a software testing method where individual units/components are tested in isolation. A unit can be described as the smallest testable part of code in an application. Unit testing is generally carried out by developers during the development phase of an application. In Node.
fs.readFileSync
appears to do what you're asking. From the manual:
fs.readFileSync(filename, [options])
Synchronous version of
fs.readFile
. Returns the contents of thefilename
.If the
encoding
option is specified then this function returns a string. Otherwise it returns a buffer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With